MVC4 ExtendedMembershipProvider and entityframework

14,002

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.

Share:
14,002

Related videos on Youtube

Tim
Author by

Tim

SRE interested in Kubernetes, Service Fabric, c# ..

Updated on September 15, 2022

Comments

  • Tim
    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
    Tim over 11 years
    cheers 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
    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
    CallMeLaNN over 11 years
    @Tim, since EF 4.1 (if not mistaken) you can use POCO classes and derived DbContext. If you use the DbContext("connStringName") constructor and WebSecurity.InitializeDatabaseConnection("connStringName"...‌​) you definitely uses one connection string.
  • Nikos
    Nikos over 11 years
    does anyone know how to change upgrade an old mvc 4 internet project to use simplemembership?