如何初始化SimpleMembershipProvider? [英] How to Initialize SimpleMembershipProvider?

查看:111
本文介绍了如何初始化SimpleMembershipProvider?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要访问的 <全部功能code> SimpleMembershipProvider 如<一个href=\"http://msdn.microsoft.com/en-us/library/webmatrix.webdata.simplemembershipprovider.validateuser%28v=vs.111%29.aspx\"相对=nofollow> 的ValidateUser 方法。

因此​​,根据其文档我不应该叫 WebSecurity.InitializeDatabaseConnection()进行初始化,而是启用标准成员资格和角色提供。

我的问题是:如何初始化SimpleMembershipProvider类

,终于有机会获得 SimpleMembershipProvider

的全部功能

,或是否有更好的解决方案,谢谢


解决方案

  我

如何初始化SimpleMembershipProvider类


如果你看一下默认的ASP.NET MVC 4互联网应用模板的AccountController装饰与 [InitializeSimpleMembership] 属性。这就是它是如何在此示例中初始化。这意味着,你将能够使用它一旦你已经通过帐户控制了,而不是之前。如果你想验证你可以做同样在之前,使用您的会员资格供应商的的Application_Start 方法。

I want to access full capabilities of SimpleMembershipProvider such as ValidateUser method.

So according to its documentation I should not call WebSecurity.InitializeDatabaseConnection() for initialization and instead enable standard membership and role providers.

My question is: How can I initialize SimpleMembershipProvider class

To Finally: have access to full capabilities of SimpleMembershipProvider

or if there is a better solution, thanks

解决方案

How can I initialize SimpleMembershipProvider class

If you look at the default ASP.NET MVC 4 Internet application template the AccountController is decorated with the [InitializeSimpleMembership] attribute. That's how it is initialized in this sample. This means that you will be able to use it once you have gone through the account controller, not before. If you want to use your membership provider before authenticating you could do the same in your Application_Start method.

这篇关于如何初始化SimpleMembershipProvider?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆