Cannot open database "aspnetdb" requested by the login

scm0sml
scm0sml used Ask the Experts™
on
Hi,

I was using the built in .met membership to develop and have now moved to the live server where I am now using a full version of sql server as opposed to express so my membership stopped working.

I have moved the aspnet.mdf to a different location and attached to sql server.

I have then changed my connection string to the following. I can log in via sql server and run selects etc against the membership database but am getting:
Cannot open database "aspnetdb" requested by the login
when trying to use the membership via the database...

Anyone see what I am doing wrong?
<add name="ApplicationServices" connectionString="data source=myserver;persist security info=True;initial catalog=aspnetdb;user id=myuser;password=mypassword;"  providerName="System.Data.SqlClient" />    

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
After enablling sa are you login to sqlserver 2005 using sa with your password(only connect to sql server management studio)??

then you find your database attached in the server or not ??

i think this exception sorce is membership control what i want you to do is to make sure that sa is enabled and yo provide password correctlly,, can you supply more information??

make sure that your  connection string is changed to use sa like this

<remove name="LocalSqlServer" />

<add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=asp_net.mdf;user id=sa;password=your password;" providerName="System.Data.SqlClient"/>

Author

Commented:
as stated in the question i have been able to log in via sql server management studio using the password and username I have specified in the conn str and can run select statements.

The problem is when I try to do the same thing via the website....

I get the error...
Commented:
The db that was atached in the management studio had been given a full path to the .mdf.

I have renamed this to just be the database name and it has worked!!

Thanks anyway!

Author

Commented:
got it working myself.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial