'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 1:[1]
You can use the Microsoft ASP.NET Universal Providers nuget package
ASP.NET Universal Providers add provider support in ASP.NET 4 for all editions of SQL Server 2005 and later and to SQL Azure. If you use these providers to develop your application, the application will be ready for cloud environments like Azure. Other than supporting additional storage options, the providers work like the existing SQL-based providers, so that you can easily switch an application to use cloud storage via SQL Azure.
And for this great Hanselman's post
The configuration for these providers is the same as the existing SqlMembershipProvider class, but the type parameter is set to the type of the new providers, as shown in the following table:
SQL Provider Types -> Equivalent Type for Universal Providers System.Web.Security.SqlMembershipProvider -> System.Web.Providers.DefaultMembershipProvider System.Web.Profile.SqlProfileProvider -> System.Web.Providers.DefaultProfileProvider System.Web.Security.SqlRoleProvider -> System.Web.Providers.DefaultRoleProvider (Built in provider) System.Web.Providers.DefaultSessionStateProvider
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
