0

Visual Studio 2012 警告该类的第一行已过时:

if (FormsAuthentication.Authenticate(UserName.Text, Password.Text) == true)

 public void LoginClass(object s, EventArgs e)
{
    if (FormsAuthentication.Authenticate(UserName.Text, Password.Text) == true)
    {
        FormsAuthentication.SetAuthCookie(UserName.Text, true);
        Response.Redirect("admin/default.aspx");
    }
    else
    {
        if (DBAuthenticate(UserName.Text, Password.Text))
        {
            FormsAuthentication.SetAuthCookie(UserName.Text, true);
            Response.Redirect("members/default.aspx");
        }
        else
        {
            LtlLogin.Text = "<p>Sorry wrong login details</p>";
        }
    }

}

我会很感激一些帮助。我应该用什么替换框架 4.5 中的这行代码?

4

1 回答 1

0

错误消息本身或 MSDN 参考页面确实向您展示了要使用的新 API,所以我认为您不需要帮助,而是自己帮助自己,

http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.authenticate(v=vs.110).aspx

于 2014-04-01T08:05:52.073 回答