A Custom Membership Provider *Without* a Database?

前端 未结 1 544
有刺的猬
有刺的猬 2021-01-29 01:38

I\'ve been looking around various SO questions, blog posts, and so forth regarding the changes to membership providers in MVC 4. While I like many of the changes and the simpli

1条回答
  •  被撕碎了的回忆
    2021-01-29 02:11

    You should be able to create a custom SimpleRoleProvider and plug it into your application by modifying the web.config to something like this:

    
    

    Where MyCustomRoleProvider is the name of the assembly that contains your implementation of SimpleRoleProvider.

    Then just rip out the initialization for SimpleMembership. This article describes how to simplify the initialization process for SimpleMembership. Basically remove the InitializeSimpleMembership attribute from the AccountController and move the initialization to the Global.asax Application_Start method. But in your case you would want to add any initialization required for your custom SimpleRoleProvider, if there is any required.

    For the implementation your are describing you will most likely have to also create a custom SimpleMembershipProvider.

    0 讨论(0)
提交回复
热议问题