Search code examples
c#.netasp.net-mvcasp.net-mvc-3sqlmembershipprovider

How do add/integrate SqlMembershipProvider in existing MVC 3 project?


On creating a new MVC project, Visual Studio take cares of SqlMembershipProvider if it is a non-empty project. Visual Studio creates a Database and all necessary Tables.

But, I have an existing MVC 3 project and I would like to add/integrate SqlMembershipProvider.

How can I add SqlMembershipProvider and create all needed Tables in my existing Database?


Solution

  • You need to run

    Aspnet_regsql.exe   ( this creates the necessary tables into your existing database)
    

    Take a look here: What's difference between windows and forms authentication in asp.net mvc 4?

    YES, ignore the sections of code that refer to comparison for windows and forms authentication. However, it should serve as useful information on SQLMembershipProvider which uses the Membership and MembershipUser classes to provide these membership services to a ASP.NET application.

    Aspnet_regsql.exe

    http://msdn.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider(v=vs.90).aspx