Friday, February 24, 2012

ASPNETDB replaces my database in connection

Hi,
I've a little problem. When I connect my local server by this connection string:Data Source=NB126\SQLEXPRESS;Initial Catalog=TVRM;Integrated Security=TrueI get content of ASPNETDB.MDF (placed in App_Data directory) instead content of my own database named TVRM. Please help...

Hi ciTrus,

Are you sure your connection string is actually used when connecting to database?(a small trick here is that, assign a wrong server name which doesnot exist to your connection string and test again. see if your data still can be populated).

Rember that there is a default "AspNetSqlMembershipProvider" in you machine.config and if you are using sql express, this provider will direct your membership database to App_Data folder silently (which i think is the case you are currently in). If you want to use a custom membership database, you need to add a new membership provider and put it to your web.config.

like: <system.web>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="20">
<providers>
<remove name="AspNetSqlProvider" />
<add name="SqlProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName=HERE IS YOUR CONNECTION STRING NAME
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
passwordFormat="Hashed"
applicationName="/" />
</providers>
</membership>
</system.web>

Hope my suggestion helps

|||

Bo Chen,
thank you very much. I did exactly what you wrote and it worked.Big Smile

CiTrus

No comments:

Post a Comment