Malaika Consultants LLC

Configure ASP.NET for Membership Provider

by Jane Thomson 6. October 2010 20:54

Configure ASP.NET for Membership Provider

In order to use the membership features of ASP.NET, it is required to configure the membership features in the machine. Here are the basic steps that to follow for the same:

1.    First of all specify the options of memberships as a part of website configuration. Please specify which membership provider shall be used for the website. The provider that is available by default stores the membership details into the SQL Server database. However, there are other membership providers to use like provider from the Windows Live Id. Let us look at how we can configure Membership provider for ASP.NET web application.

2.    ASP.NET membership can be configured with the element membership located in the web.config file for the web application. In fact, the membership is a sub-element of the system.web section. It is possible to enable the ASP.NET membership directly by editing the web.config file of the web application. Even a website administration tool can be used for the same that provided the wizard based interface to configure it. To configure the membership feature, user has to specify:

a.    The membership providers to use. It also includes the database to store the membership information.

b.    Password option like encryption and whether it’s feasible to support the password recovery based on the user information.

c.    Username and Passwords. If the web administration tool has been used, users can be directly created and managed. If not, user has to call membership functions to create as well as manage the users.

3.    There is another feature with the membership provider is to select the membership provider with defaltprovider characteristic of membership element. There is a machine configuration SQLMembership Provider instance with the name “AspNetSqlMembershipProvider” which works as a default provider if the default provider hasn’t been specified. The “AspNetSqlMembershipProvider” provider is connected with the aspnetdb database in the SQL Server of the local machine. However, a user has to set up the database which is used by “SqlMembershipProvider” before it can be used in the application.

 

Specifying the Default Provider


You specify the default membership provider using the defaultProvider attribute of the membership element. The machine configuration specifies a SqlMembershipProvider instance named "AspNetSqlMembershipProvider" that is identified as the default provider if you do not specify a default provider explicitly. The "AspNetSqlMembershipProvider" connects to the aspnetdb database in the local SQL Server.

Please refer to the code below in order to check the web.config file.

<configuration>

  <connectionStrings>

    <add name="MySqlConnection" connectionString="Data

      Source=MySqlServer;Initial Catalog=aspnetdb;Integrated

      Security=SSPI;" />

  </connectionStrings>

  <system.web>

    <authentication mode="Forms" >

      <forms loginUrl="login.aspx"

        name=".ASPXFORMSAUTH" />

    </authentication>

    <authorization>

      <deny users="?" />

    </authorization>

    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">

      <providers>

        <clear />

        <add

          name="SqlProvider"

          type="System.Web.Security.SqlMembershipProvider"

          connectionStringName="MySqlConnection"

          applicationName="MyApplication"

          enablePasswordRetrieval="false"

          enablePasswordReset="true"

          requiresQuestionAndAnswer="true"

          requiresUniqueEmail="true"

          passwordFormat="Hashed" />

      </providers>

    </membership>

  </system.web>

</configuration>

 

Tags:

Coding

Comments

10/7/2010 7:57:20 AM #

Configure ASP.NET for Membership Provider

You've been kicked (a good thing) - Trackback from DotNetKicks.com

DotNetKicks.com | Reply

2/27/2012 9:49:11 AM #

I want to start a newspaper online and need to register the name and the content. Need to do it internationally. However, not a clue how to do it... I've already got a domain, but the title would be slightly different from the domain name..

hcg United States | Reply

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading



::: | © Malaika Consultants LLC | :::

Malaika Consultants LLC

Malaika Consultants LLC is a custom software development consulting firm located in Cary (Raleigh Durham Research Triangle AKA RTP area ) North Carolina. We offer our expert consulting services in the Microsoft .NET and related technologies. Our mission is to partner with you and ensure the success of your project. We have a team in the USA that will help you with your Information Technology needs and we strive to be truly "Your Information Technology Angels"

We are offering 1 hour of free consulting -- ASP.NET, SQL Server, IIS, anything. Contact us to get your free consulting

Recent Comments

Comment RSS