I did not notice first that there two different types of web projects namely Web Site Project and Web Application Project. When I noticed, I wonder why MS came up with two different types of projects until I read this Introduction to Web Application Projects article. As it explains, MS created this new Web Application Project type for those developers, who are not comfortable with certain new features such as
1. Web Site Project model creates multiples assemblies.
2. Web Site project does not use Project file.
3. Web Site Project uses new semantic like sub projects where it just meant another project which feeds its assemblies to parent's bin folder.
But essentially, it just gives additional ways to manage the web projects.
How do you react if something is not simple when it is supposed to be? I tried to use Web Site Admin tool for my web site. The Provider tab was erroring out as
"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. "
Ok I ran the aspnet_regsql to install and configure the DB.Still I could not use the Provider Management. You would think that if you manually add the <Membership> element in the web.config would help you.
<membership>
<providers>
<add connectionStringName="MylSqlServer" name="AspNetSqlProvider" Type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>
Nope. Little bit Googling helped me to figure out what is the problem.
1. You manually need to add the connection details within the <ConnectionStrings> section for the new aspnetDB
<add name="MySqlServer" connectionString="YOUR CONNECTION STRING" providerName="System.Data.SqlClient" />
2. Here is the tip.You also need to remove the entry before adding!!
<remove name="MySqlServer"/>
Why do you want to remove before adding? At least the error message could have been more informative.