What would be equivalent web.config configuration for "enableSimpleMembership"="true:
Asked Answered
E

1

3

What would be equivalent configuration of Membership and Role providers in Web.Config for:

<appSettings>
  <add key="enableSimpleMembership" value="true" />
</appSettings>

in ASP.NET MVC 4?

Ennui answered 4/3, 2013 at 23:25 Comment(1)
possible duplicate of Setting up SimpleMembership in MVC4Lonergan
E
5

Equivalent configuration of web.config would be:

<appSettings>
  <add key="enableSimpleMembership" value="false" /><!-- false is default if key is not present -->
</appSettings>
<connectionStrings>
  <add name="DefaultConnection" connectionString="..." providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
  <membership defaultProvider="SimpleMembershipProvider">
    <providers>
      <add name="SimpleMembershipProvider" type="WebMatrix.WebData.SimpleMembershipProvider" />
    </providers>
  </membership>
  <roleManager defaultProvider="SimpleRoleProvider" enabled="true">
    <providers>
      <add name="SimpleRoleProvider" type="WebMatrix.WebData.SimpleRoleProvider" />
    </providers>
  </roleManager>
</system.web>
Ennui answered 4/3, 2013 at 23:25 Comment(3)
I'm getting Unrecognized configuration section roleManager with this in my app.config for tests.Capitate
Indeed. I edited answer. membership and roleManager under <system.web> node.Ennui
yes, works this way. However I've been having assembly errors until I've added assembly name like this: type="WebMatrix.WebData.SimpleMembershipProvider, WebMatrix.WebData"Capitate

© 2022 - 2024 — McMap. All rights reserved.