Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MVC4 ExtendedMembershipProvider and entityframework

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

like image 999
Tim Avatar asked Aug 29 '12 15:08

Tim


2 Answers

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

like image 146
pranav rastogi Avatar answered Oct 20 '22 01:10

pranav rastogi


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.

like image 2
Johan Avatar answered Oct 20 '22 02:10

Johan