Reputation: 16224
I am using the standard ASP.NET Webform template and its membership provider. Specifically I am using only the external id services (Google, Microsoft, Facebook, Twitter). All these worked fine, until I decided to point the database away from the default localdb to my own.
In web.config I changed the connectionStringName
attribute in <profile>, <membership> and <roleManager> from the default DefaultConnection
to my own connection string name. The following tables were then automatically created in my database: Users
, Roles
, Profiles
and Memberships
. However, it continued to use UsersOpenAuthAccounts
and UsersOpenAuthData
from localdb!
To find out who was using localdb, I deleted the connection string "DefaultConnection". The access was from OpenAuth.Login
. The error message was "Cannot attach the file d:\....\visual studio 2012\Projects\...\App_Data\DefaultConnection.mdf as database 'DefaultConnection'."
I am puzzled why this is happening. There is no DefaultConnection.mdf file in App_Data. There is only a aspnet-XXXX-yyyyMMddhhmmss.mdf.
Bottomline is: how do I make the membership provider use the two OpenAuth tables in my own database?
Thanks.
Upvotes: 3
Views: 2126
Reputation: 16224
Looking in the OpenAuth class metadata from VS, there is a static string property called ConnectionString
.
And using Reflector, the constructor of OpenAuth can be seen to initialize the ConnectionString
property to "DefaultConnection".
The user can therefore change the connection string used by OpenAuth anytime by simply updating this property.
Upvotes: 3