RegeditHandler.ashx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

namespace reggditProject
{
    /// <summary>
    /// Summary description for RegeditHandler
    /// </summary>
    public class RegeditHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            string userName = context.Request.Form["userName"];
            string password = context.Request.Form["password"];
            //context.Response.Write(userName);  
            string path = @"E:\郝光明工作\工作\代码审核\11.10\第一个注册\reggditProject\reggditProject\profile\userInfos.txt";
            
            string content=File.ReadAllText(path);
            //判断是否存在已注册的用户名
            bool isExitUser=false;
            string[] userInfos=content.Split('|');
            foreach (string userInfo in userInfos)
            {
                if(userName.Equals(userInfo.Substring(0,userInfo.IndexOf("&"))))
                {
                    isExitUser=true;
                    break;
                }
            }

            if(isExitUser)
            {
                context.Response.Redirect("regedit.htm");
            }else{
                string newUser=userName+"&"+password;
                content+="|"+newUser;
                File.WriteAllText(path,content);
                 context.Response.Write("OK");
            }
           
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。