VJA*_*JAI 5 membership-provider asp.net-mvc-4
我正在尝试在 ASP.NET MVC4 应用程序中实现表单身份验证,我只有一个用户将通过身份验证来执行一些管理活动。
<authentication mode="Forms">
<forms timeout="2880" loginUrl="~/Admin/Login" slidingExpiration="true">
<credentials passwordFormat="Clear">
<user name="user" password="password"/>
</credentials>
</forms>
</authentication>
Run Code Online (Sandbox Code Playgroud)
当我尝试使用该FormsAuthentication.ValidateUser方法时,我收到一个过时的警告,我应该使用 nowMembership类。
我的问题是如何在 web.config 中配置成员资格提供程序以使用 web.config 中的凭据设置?我应该在name属性中指定什么提供者?
不幸的是,正如您所描述的,没有内置的成员资格提供程序用于将凭据存储在 web.config 中。您可以编写自己的方法来调用FormsAuthentication.Authenticate方法,或者从您自己的自定义登录控件的代码隐藏中调用该方法。
| 归档时间: |
|
| 查看次数: |
889 次 |
| 最近记录: |