如何验证用户是否已在ASP.NET MVC2中登录网站?

时间:2010-12-26 04:54:14

标签: asp.net asp.net-mvc-2 asp.net-membership

我在数据库中有一个名为Customer的表,我想让他们登录网站?有什么好的做法可以提出建议吗?谢谢!

1 个答案:

答案 0 :(得分:1)

在web.config中启用表单身份验证。

创建登录页面,并在登录方法中验证用户。使用FormsAuthentication类设置身份验证cookie。

以下是对forms authentication

的撰写

如果您在visual studio中创建一个asp.net mvc站点项目,您将看到身份验证的实现。