MVC4 ExtendedMembershipProvider and entityframework
Solution 1
the issue here is that the default mvc4 internet template is using simplemembership to manage membership/roles information. the code in the template has assumption of this and can only work with simplemembership. when you install universal providers the account controller code blows up since it cannot understand universal providers. look at this post which explains further on this scenario http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx
Solution 2
I have the same issue,
however mine isn't solved, but many people say add this to your web.config
<add key="enableSimpleMembership" value="false"/>
<add key="autoFormsAuthentication" value="false"/>
and if that doesn't work try making the top one true as well.
Related videos on Youtube
Comments
-
Tim over 1 year
i want to be able to use the same database for the application as the asp membership details for forms authentication. I am currently using MVC4. When i started and added the system.web.providers to my project i got a seperate default connection. I have modified the string to point to the same database as that being used in my application (entityframework).
Should i expect the providers to autocreate the tables in this database i.e.
- webpages_Membership
- UserProfile
- webpages_Roles
- webpages_OAuthMembership
Currently I am getting...
To call this method, the "Membership.Provider" property must be an instance of "ExtendedMembershipProvider"
when i try and register a new user via the default mvc4 application template. And the tables are absent.
regards Tim
-
Tim over 11 yearscheers pranav, spotted the universal providers issue and removed this. i have resolved this issue, now however i just need to resolve the having two connection strings in my webconfig, i have one for the entity framework connection and another which is a normal (not an EF connection string) string but pointing to the same database for webpages_tables (simplemembershipprovider tables)
-
AlignedDev over 11 years+1 Thanks for the link. I've been trying to understand what was different with the MVC4 membership tables and what changed. "WSAT is built to work with ASP.NET Membership, and is not compatible with Simple Membership." from the article and other information helped clear that up.
-
CallMeLaNN over 11 years@Tim, since EF 4.1 (if not mistaken) you can use POCO classes and derived
DbContext
. If you use theDbContext("connStringName")
constructor andWebSecurity.InitializeDatabaseConnection("connStringName"...)
you definitely uses one connection string. -
Nikos over 11 yearsdoes anyone know how to change upgrade an old mvc 4 internet project to use simplemembership?