且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

登录控制身份验证不使用用户定义的数据库

更新时间:2023-12-04 22:07:28

在下面试试

try below
protected void login1_Authenticate(object sender, AuthenticateEventArgs e)
{
    string un = login1.UserName;
    string pw = login1.Password;
    bool result = Userlogin(un, pw);
    if (result)
    {
        FormsAuthentication.SetAuthCookie(un, true);
        e.Authenticated = true;
        Session["username"] = un;
    }
    else
    {
        e.Authenticated = false;
    }
}