Reputation: 1226
I am trying to get SqlProfileProvider working with my own db, I have set up the db using aspnet_regsql and then the following web.config, yet the application keeps creating an aspnetdb and never populates any of the tables in my db.
<connectionStrings>
<add name="Database"
connectionString="Server=MYSERVER;Integrated Security=True;Initial Catalog=MYDB"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<membership defaultProvider="AspNetActiveDirectoryMembershipProvider">
<providers>
<add name="AspNetActiveDirectoryMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider,
System.Web, Version=2.0.3600, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" />
</providers>
</membership>
<profile defaultProvider="AspNetSqlProfileProvider">
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider"
connectionStringName="Database"
applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false" />
Upvotes: 2
Views: 1051
Reputation: 37388
Try adding a <clear />
tag immediately after the <connectionStrings>
tag. I seem to remember having a similar problem years ago that was caused by my web.config inheriting a connection string from somewhere else.
http://msdn.microsoft.com/en-us/library/ayb15wz8.aspx
<connectionStrings>
<clear />
<add name="Database"
connectionString="Server=MYSERVER;Integrated Security=True;Initial Catalog=MYDB"
providerName="System.Data.SqlClient" />
</connectionStrings>
EDIT:
Actually, you should also add the <clear />
tag to your membership providers as well.
Common Gotcha: Don't forget to <clear/>
when adding providers
Upvotes: 3