Print Page | Close Window

Changing Membership Provider ASP.NET 2.0

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=17256
Printed Date: 28 March 2026 at 11:06pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Changing Membership Provider ASP.NET 2.0
Posted By: davidshq
Subject: Changing Membership Provider ASP.NET 2.0
Date Posted: 14 November 2005 at 8:13pm
Okay, heres my dilemma. When I created my application Visual Web Developer Express automatically generated the ASPNETDB.MDF database. I created a separate database - DATABASE.MDF which stores most of the important info. (other than user info.). Now I want to combine those two databases into one - preferrably ASPNETDB.MDF into DATABASE.MDF. I don't need any of the information that is currently in ASPNETDB, and I am wondering, is there a way to have the SqlMembershipProvider point to DATABASE.MDF and automatically recreate all the tables, etc. it made in ASPNETDB.MDF?
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Replies:
Posted By: michael
Date Posted: 15 November 2005 at 1:36pm

create an empty database

run aspnet_regsql.exe which is located in the 2.0 Framework Directory, this will create all aspnet tables.
 
Then in the web.config you need to create our providers someting like this:

<connectionStrings>
  <remove name="LocalSqlServer" />
  <add name="SqlServices" connectionString="Data Source=yourconnectionString here" />
   </connectionStrings>
<!-- Now the providers, configured to manually look at yours-->
<membership defaultProvider="csIntra">
   <providers>
    <clear/>
    <add connectionStringName="SQLServices" applicationName="csIntra" name="csIntra" type="System.Web.Security.SqlMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false"/>
   </providers>
  </membership>
  <roleManager enabled="true" defaultProvider="csIntra">
   <providers>
    <clear/>
    <add connectionStringName="SQLServices" applicationName="csintra" name="csIntra" type="System.Web.Security.SqlRoleProvider"/>
   </providers>
  </roleManager>
  <profile defaultProvider="csIntra" enabled="true">
   <providers>
    <clear/>
    <add name="csIntra" applicationName="csIntra" type="System.Web.Profile.SqlProfileProvider" connectionStringName="SQLServices"/>
   </providers>
   <properties>
    <add name="office" type="System.String"/>
    <add name="department" type="System.String"/>
    <add name="DefaultProducts" type="System.Collections.ArrayList"/>
   </properties>
  </profile>
  <webParts>
   <personalization>
    <providers>
     <clear/>
     <add connectionStringName="SQLServices" name="AspNetSqlPersonalizationProvider" applicationName="csIntra" type="System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
    </providers>
 
There is some of my stuff in there you may need to take out but hope it gives you an idea.


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: michael
Date Posted: 15 November 2005 at 1:36pm
Really sorry for the bad paste but if you copy paste it into your web.config it should format fine.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: davidshq
Date Posted: 15 November 2005 at 5:21pm
Thanks Michael. The problem is I already have a database and I just want to add the schema to that database. Its a SQL Server 2005 Express db just like ASPNETDB.MDF. I attempted using the instructions at the link below, but it won't work. http://weblogs.asp.net/lhunt/archive/2005/09/26/425966.aspx
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.


Posted By: davidshq
Date Posted: 15 November 2005 at 11:36pm
I believe I actually got the info. to copy into the database, I just need to know how to make it so that the SQL Express Membership Provider points to the new SQL Server Express database I have instead of the old one.
In other words, all the tables are the same names, its just that the database is now database.mdf instead of ASPNETDB.MDF.
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.


Posted By: michael
Date Posted: 16 November 2005 at 9:36am
For this you can use the web.config example I posted above. I will let you point to a different DB

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: davidshq
Date Posted: 16 November 2005 at 11:14pm
Thanks. The app. works now. ;-)

-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net