ASP.NET 登录身份验证 二 自定义模式(framework)

reference:
framework.supesoft.com/

Login.aspx页面分析:
button事件
{
判断页面输入是否正确,如果正确,则进入一个叫Messagebox的中间页面,里面有个button指向default.aspx
注意这里在CheckLogin()里面同时进行了以下操作:
        private void Signin(sys_UserTable sUT)
        {

            System.Web.Security.FormsAuthenticationTicket tk 
= new FormsAuthenticationTicket(1,
                    sUT.UserID.ToString(),
                    DateTime.Now,
                    DateTime.Now.AddMinutes(
30),
                    
true,
                    
"",
                    System.Web.Security.FormsAuthentication.FormsCookiePath
                    );

            
string key = System.Web.Security.FormsAuthentication.Encrypt(tk); //得到加密后的身份验证票字串 

            HttpCookie ck 
= new HttpCookie(System.Web.Security.FormsAuthentication.FormsCookieName, key);
            
//ck.Domain = System.Web.Security.FormsAuthentication.CookieDomain;  // 这句话在部署网站后有用,此为关系到同一个域名下面的多个站点是否能共享Cookie
            HttpContext.Current.Response.Cookies.Add(ck);
        }

如果输入不正确,进入messagebox页面,里面有个Button指回login.aspx
}

感觉上说白了还是用了asp.net的security框架,而且有些代码写的不是很到位,没有single minded。比如就那个Checklogin()里面竟然有保存身份验证的代码,非常的违规(导致我多花了几分钟找哪里保存信息了)。
原文地址:https://www.cnblogs.com/zc22/p/958589.html