Using the Web Site Administration Tool, I created a couple of users and roles, and a database has been created, but that same tool gives me this error when I click 'Test' under the 'Providers' tab:
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
I don't see why I need to use that tool, since the Web Site Administration Tool already created the database in the Project's App_Data folder. So I'm assuming it is some kind of connection string issue.
In my machine.config, the connection string is:
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
In my web.config, I have tried this:
connectionString=".\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=True"
In my Server Explorer (CTRL+ALT+S), right-click on the db and choosing advanced shows this connection string:
Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Users\user1\Documents\Visual Studio 2008\Projects\TryMembership6\TryMembership6\App_Data\ASPNETDB.MDF";Integrated Security=True;User Instance=True
And I have tried modifying my web.config connection string with some of the stuff I saw in the server explorer connection string, but nothing has worked so far. I tried the following:
1) switching the dot (.) with the machine name ROSE-W7\SQLEXPRESS
2) setting integrated security to True from SSPI
3) replacing the DataDirectory with the actual physical path.
Basically, I'm not sure how to get rid of this error. If someone really knows, please help me.