.Net Forms身份验证

时间:2010-12-10 11:28:43

标签: asp.net-mvc authentication windows-authentication

我正在用mvc2开发一个网站,我正在使用.net身份验证。如何更改登录授权以使用电子邮件和密码。

感谢

1 个答案:

答案 0 :(得分:1)

在发出身份验证Cookie的控制器操作中,只检查邮件是否与密码匹配,并使用电子邮件作为身份验证Cookie的用户名:

[HttpPost]
public ActionResult Login(string email, string password)
{
    // TODO: query your membership provider and verify if the given email
    // matches the password and if they match emit the authentication cookie
    // using the email as username

}