Custom memebrship provider problem

J

John

Hi

I am trying to setup a customised membership provider and I am getting the
following error when trying to run the app;

The entry 'AspNetSqlMembershipProvider' has already been added.

The line is: <add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />

What is the problem and how can I fix it? The complete web.config content is
below.

Thanks

Regards

Web.Config

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>

<connectionStrings>
<add name="Personal" connectionString="Data
Source=.\MSSQLSERVER;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|Events.mdf"
providerName="System.Data.SqlClient"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"/>
</connectionStrings>

<system.web>
<compilation debug="true" strict="false" explicit="true"/>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<authentication mode="Forms">
<forms name="LoginAuthCookie" loginUrl="Login.aspx">
<!--<credentials passwordFormat="Clear">
<user name="john" password="password" />
<user name="mike" password="test" />
</credentials>-->
</forms>
</authentication>

<authorization>
<deny users="?" />
</authorization>

<!--<membership>
<providers>
<add connectionStringName="SqlServices"
requiresQuestionAndAnswer="false"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
name="AspNetSqlProvider"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>-->

<membership>
<providers>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="true"
applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>

<profile>
<providers>
<add name="AspNetSqlProfileProvider"
connectionStringName="LocalSqlServer" applicationName="/"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</profile>

<roleManager>
<providers>
<add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer"
applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="AspNetWindowsTokenRoleProvider" applicationName="/"
type="System.Web.Security.WindowsTokenRoleProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</roleManager>

</system.web>

<location path="register.aspx">
<system.web>
<authorization>
<allow users="*"></allow>
</authorization>
</system.web>
</location>

</configuration>
 
D

Daniel TIZON

Hi John,
The entry "ASPSQL Membership Provider is already defined in the
MACHINE.CONFIG placed in then following folder.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\
If you want to override it, you should unregister the inherited before
overriding it with the following statement
<remove name="AspNetSqlMembershipProvider"/>
<add name="AspNetSqlMembershipProvider" ...../>

another solution consists to use another label for example :
"MyMemberShipProvider"
and to set it as the default membership provider with the following
<membership defaultProvider="MyMemberShipProvider">
<providers>
<add name="MyMemberShipProvider" .... />
</providers>
</membership>

I hope this helps
 
K

Keith Patrick

That is a reserved provider name. Try using the <clear> element to empty
the list first:
<providers>
<clear/>
<add.../>
<providers>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,044
Messages
2,570,388
Members
47,052
Latest member
ketan

Latest Threads

Top