Your full service technology partner! 
-Collapse +Expand
Search C# Group:

-Collapse +Expand C# To/From
-Collapse +Expand C# Study Test
-Collapse +Expand C# Store

Prestwood eMagazine

December Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingC#   Print This     
  From the September 2008 Issue of Prestwood eMag
Applying the Built-in ASP.NET User-Login Functionality to Your Database
Posted 13 years ago on 7/22/2008 and updated 9/1/2008
Take Away: Using aspnet_regsql.exe to set up a database to support the functionality of ASP.NET 2.0's built-in membership.


In order to use your own SQL Server database to store login information using the built-in ASP.NET 2.0 Membership functionality, you must run the aspnet_regsql.exe tool. If this is not done the site defaults to using the ASPNETDB.MDF database located in the App_Data folder and will not be connected to any existing databases.

The aspnet_regsql.exe tool is located under [drive]:\...\Microsoft.NET\Framework\[versionnumber]

(Default location is C:\Windows\Microsoft.NET\Framework\[versionnumber])

This tool can be run with command-line arguments to specify settings.
These include:
    -C <connectionstring> :: specifies the connection string to the database
    -S <server> :: specifies the server the database is located on
    -A all/m/r/p/c/w :: adds support for services
            m: membership
            r: roles
            p: profiles
            c: web parts
            w: web events
    -R all/m/r/p/c/w :: removes support for above services
    -d <database> :: specifies the name of the database

This tool can also be run without command-line arguments in order to pop up a wizard which steps through the process of setting up the database.

Once the database is set up you must change the Membership provider. This can be done by adding this code to your web.config:

  <add name="YourConnectionString" connectionString="..." />

  <roleManager enabled="true"
    <add name="MyRoleProvider" type="System.Web.Security.SqlRoleProvider"
          connectionStringName="YourConnectionString" />

  <membership defaultProvider="MyMembershipProvider">
    <add name="MyMembershipProvider"
      connectionStringName="YourConnectionString" />

You can then go into the ASP.NET Configuration and select the new provider by selecting the "Select a different provider for each feature (advanced)" link under the Providers tab.


Share a thought or comment...
First Comment
Comment 1 of 4

Hey fellas! Can somebody write my difficult hometasks like essays? Has anybody heard about the fastest and the cheapest writing company? My good friend bought some essay papers and dissertation papers to be done. If you have any questions you can ask it by clicking on online website!

Posted 22 months ago

Comment 2 of 4

Gotoassignmenthelp Service strives to meet the higher education standards of the university through the best quality assignments when you require Assignment Help Oman. Assignments are written logically and all errors are corrected for a flawless finish in our assignment help service online. When you choose our Dissertation Help service, you need to think about the quality and your grades as well. On taking Gotoassignmenthelp service online from worldwide, We guarantee the original content and flawless work.. Professors of the reputed universities consider assignments to be the most efficient method to assess a students’ writing caliber along with their understanding of the course. Gotoassignmenthelp is the best Android Assignment Help provider in worldwide.

Posted 21 months ago

Comment 3 of 4

Are you searching for someone to do my assignment? Avail of online assignment help and finish your academic papers easily. Take assignment helpers’ assistance via online writing services and make your submission effective for an entire session.

Posted 19 months ago

Latest Comment
Comment 4 of 4

Thanks for your post. This article gives me a lot of advice, it‘s very helpful for me!


Posted 7 months ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P147A1
Enter key:
KB Post Contributed By Stephen Berry:
Visit Profile

 KB Article #101291 Counter
Since 7/22/2008
Sales Website: Or visit our legacy sales site:

©1995-2021 Prestwood IT Solutions.   [Security & Privacy]