Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Custom memebrship provider problem

Reply
Thread Tools

Custom memebrship provider problem

 
 
John
Guest
Posts: n/a
 
      12-16-2005
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|Even ts.mdf"
providerName="System.Data.SqlClient"/>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data
Source=.\SQLEXPRESS;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|aspn etdb.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>




 
Reply With Quote
 
 
 
 
Daniel TIZON
Guest
Posts: n/a
 
      12-16-2005
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\CONF IG\
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

--
Daniel TIZON
MCP - MCSD.NET - MCT


"John" <(E-Mail Removed)> a écrit dans le message de news:
http://www.velocityreviews.com/forums/(E-Mail Removed)...
> 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|Even ts.mdf"
> providerName="System.Data.SqlClient"/>
> <remove name="LocalSqlServer"/>
> <add name="LocalSqlServer" connectionString="Data
> Source=.\SQLEXPRESS;Integrated Security=True;User
> Instance=True;AttachDBFilename=|DataDirectory|aspn etdb.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>
>
>
>
>



 
Reply With Quote
 
 
 
 
Keith Patrick
Guest
Posts: n/a
 
      12-16-2005
That is a reserved provider name. Try using the <clear> element to empty
the list first:
<providers>
<clear/>
<add.../>
<providers>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Membership Provider - Custom Error Messages Brett Ossman ASP .Net Security 0 03-11-2009 09:33 PM
Unable to redirect when using custom 'Login' with custom 'Membership provider' asnowfall@gmail.com ASP .Net 0 06-05-2007 05:15 PM
Custom memebrship provider problem John ASP .Net Security 3 12-16-2005 09:05 PM
Custom memebrship provider problem John ASP .Net Web Controls 2 12-16-2005 09:05 PM
Informix .net provider - Sql server .net provider BS ASP .Net 3 06-17-2004 01:11 AM



Advertisments