VB .Net - ASP too

Friday, December 02, 2005

Adding an SQL server membership provider

This goes inside configuration. This is a normal connection string nothing out of the ordinary.

<connectionstrings>
<add name="MyLocalSQLServer" connectionString="Initial Catalog=aspnetdb;data source=localhost;Integrated Security=SSPI;" />
</connectionstrings>


This is all within the system.web namespace
Under authentication mode change it to forms and add the forms tag with attributes

<authentication mode="Forms">
<forms
name="SqlAuthCookie"
timeout="10" />
</authentication>
ADd authorization for the site:
<authorization>
<deny users="?" />
<allow users="*" />
</authorization>

Add the provider under authorization tag. Connection string refers to the one added above.

<membership defaultProvider="MySqlMembershipProvider" >
<providers>
<clear/>
<add name="MySqlMembershipProvider"
connectionStringName="MyLocalSQLServer"
applicationName="TestReports"
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>

0 Comments:

Post a Comment

<< Home