Question

i am just creating a aspnet MVC 4 basic application with custom membership provider. I follow these steps:

1) Create the membership tables in the Sql Server 2008 using aspnetregsql.exe So i have the custom membership tables like:

aspnet_Users

aspnet_Membership

aspnet_Roles ...

2) Added a connection string refering to this database.

3) Added a provider in my web.config file inside the membership section:

<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" 
         connectionStringName="primecontrol" enablePasswordRetrieval="false" 
         enablePasswordReset="true" requiresQuestionAndAnswer="false" 
         requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" 
         minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" 
         passwordAttemptWindow="10" applicationName="/" />

So, when I run the ASP.NET configuration Tools and go to test my provider connection, it says that i dont create any providers.

But if i create a new user for example, it creates another tables in my database without the 'aspnet' prefix. Whats going on?

Was it helpful?

Solution

i am just creating a aspnet MVC 4 basic application with custom membership provider.

In the web.config, I do not see declaring custom membership provider.

It should be like -

<membership defaultProvider="CustomProvider">
   <providers>
     <clear/>
        <add name="CustomProvider" 
         type="YourNamespace.YourMembershipProvider, YourNamespace" 
         ... />
   </providers>
</membership>

If you using ASP.Net MVC 4, you want to use new ASP.NET Universal Providers which is basically a newer version of Legacy Membership Provider that you are using.

ASP.NET Universal Providers uses Entity Framework Code First which is a lot cleaner compare to store procedures.

If you want to latest Membership, you might want to try ASP.NET Identity. Note: Identity is not backward compatible with Legacy Membership Provider.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top