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

Advanced
-Collapse +Expand C# To/From
To/FromCODEGuides
-Collapse +Expand C# Study Test
PRESTWOODCERTIFIED
-Collapse +Expand C# Store
PRESTWOODSTORE

Prestwood eMagazine

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

   ► KBProgrammingC#   Print This     
  From the September 2008 Issue of Prestwood eMag
 
C#:
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.

KB101291

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 asp.net 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:

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

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

  <membership defaultProvider="MyMembershipProvider">
   <providers>
    <add name="MyMembershipProvider"
      type="System.Web.Security.SqlMembershipProvider"
      connectionStringName="YourConnectionString" />
   </providers>
  </membership>

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.


Comments

1 Comments.
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 https://samedayessay.com 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!

directions

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
6816
Since 7/22/2008
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


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