.NET MVC 3 (C#) default membership provider - how to set up?

夙愿已清 提交于 2019-12-22 20:54:31

问题


I'm somewhat confused by membership providers for .NET. I have built a MVC 3 web application, but obviously login pages don't work out-of-the-box because I need to wire up a membership provider. I would have expected this process to be easy, but when I search for help I find numerous articles on writing custom providers. Can't I just set up a table or two, wire up a few details in web.config and have things work based on some default MVC membership provider?

I have no desire to re-invent the wheel!

TIA.


回答1:


The MSDN membership installation documentation is still applicable through to .NET 4, although note that the default Membership provider changes in 4.5 - totally different table structures.

TL;DR

  • Create the aspnet membership database OR add the tables to your existing database (aspnet_regsql.exe, which is in the .net 2 framework folder)

  • Add the necessary membership and role provider configuration sections to your web.config.

  • Use the site admin tool to add users (or at least an initial Admin User)



来源:https://stackoverflow.com/questions/12391506/net-mvc-3-c-default-membership-provider-how-to-set-up

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!