sqlexpress with asp.net role & membership
Posted on 2010-04-07
This is my platform for this small website:
SQL Express 2008
developed by Visual Studio 2008 web express
And this is how I run my website:
The database is automatically created by visual web studio, as a MDF file inside of App_Data, I named it database.mdf
I upload every files via ftp, include the MDF file, and change the app_data folder writable from Network Services Account
I added following line at web.config:
<add name="iConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
The website runs smoothly, no problem at all.
The problem came when I start use the Roles & Memberships, the visual web studio express automatically create another database file, named Aspnetdb.mdf, and stores everything about roles and memberships to that database.
My question is: How can get rid of the aspnetdb.mdf, and use my own database.mdf to store Roles and Memberships?
Here are steps I've done and searched, and it's not working.
1. "aspnet_regsql.exe" is the tools that ppl tell me to use, to make my database.mdf capable to run the Roles and Memberships. Well, when I try to use the aspnet_regsql.exe, it couldn't even find my database.mdf.
2. I tried manually rename the aspnetdb.mdf, but it doesn't work this way, everytime the website will try to create aspnetdb.mdf by itself, i think i need to modify some line in web.config?
any solution would be helpful, but make sure you understand my develop environment, thanks in advance