Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Built-in controls with custom providers

Reply
Thread Tools

Built-in controls with custom providers

 
 
John
Guest
Posts: n/a
 
      12-16-2005
Hi

I have created custom membership/role/profile providers as per the
web.config below. My questions are;

1. Have I defined them correctly?

2. How can I make the Login and Create User Wizard controls to use these
providers instead of the standard providers?

Thanks

Regards

web.config follows

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

<connectionStrings>
<add name="Events" 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"/>-->
<add name="Membership" connectionString="Data
Source=.\MSSQLSERVER;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|Memb ership.mdf"
providerName="System.Data.SqlClient"/>
</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="MembershipProvider"
type="System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="Membership" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
</providers>
</membership>

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

<roleManager>
<providers>
<add name="RoleProvider" connectionStringName="Membership"
applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="WindowsTokenRoleProvider" 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
 
 
 
 
Joshua Flanagan
Guest
Posts: n/a
 
      12-17-2005
1) I didn't check the syntax. Did you? Do you get any errors?

2) Set the defaultProvider attribute to the name you gave to your custom
providers, on each of the parent elements.

For example:
<membership defaultProvider="MembershipProvider">
<providers>
<add...
</providers>
</membership>


Do the same for <profile> and <roleManager>

Joshua Flanagan
http://flimflan.com/blog
 
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
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
Help - custom providers and instances Tullamore ASP .Net 0 10-31-2006 08:00 AM
Custom resource providers: as simple as they seem? Jimmy ASP .Net 2 10-02-2006 10:48 AM
Built-in controls with custom providers John ASP .Net Security 0 12-16-2005 08:43 PM
Built-in controls with custom providers John ASP .Net Web Controls 0 12-16-2005 08:43 PM



Advertisments