| Author |
Topic Search Topic Options
|
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
Topic: Changing Membership Provider ASP.NET 2.0 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.
|
|
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
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
|
|
|
 |
davidshq
Senior Member
Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
|
Post Options
Thanks(0)
Quote Reply
Posted: 16 November 2005 at 11:14pm |
|
Thanks. The app. works now. ;-)
|
|
|
 |