- Create a new Website
- Open View/Server Explorer
- Right Click on Data Connections
- Select Create New SQL Server Database
- Enter the name of location & name of the Server, then the name of the database.
- Then press OK.
Now we shall use the aspnet_regsql tool that ships with Visual Studio tools, to configure the newly created database for membership use.
Here is how you do it ---
Here is the configured database.
Now we shall register our Membership Provider in the machine.config XML File that is to be found under
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG
Replace C:\Windows with the path of your windows installation.
add the following code in the Connection Strings section:
<add name="NewMembershipDB" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=MemberShipDB" providerName="System.Data.SqlClient"/>
Add the new MemberShip Provider in the membership/providers section
<add name="NewMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="NewMembershipDB" enablePasswordRetrieval="true" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="true" passwordFormat="Clear" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="4" minRequiredNonalphanumericCharacters="2" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
Use the ASP.Net Configuration tool to configure the membership provider for your website. Select the membership provider that we prepared before:-
Select the Provider Tab and select our membership provider NewMembershipProvider which should be visible there Then, open the security tab and select authentication type to: From the Internet
The membership provider is now ready. In the next post we shall use the membership controls in ASP.NET.
This is the link to the next post in the series:-
No comments:
Post a Comment