Friday, March 9, 2012

PLEASE! - Login failed for user MACHINENAME\ASPNET.

Help!! I am using Sql Server 2005 Express.

I am trying to connect to it from an aspx page.

I get the error:

Cannot open user default database. Login failed.
Login failed for user 'MACHINENAME\ASPNET'.

I have added MACHINENAME\ASPNET as a user to the database I am trying to connect to using SQL Server Management Studio Express.

Why wont it let me connect?

Any help on the matter would be most welcome.

Thanks you.

Hi,
I use sql server 2000 but I had th same problem a few months ago. You should examine 2 options. First look at the groups in your windows not on the sql server and see if aspnet and guest accounts are enabled or disabled. If they are disabled pls make them enabled then delete the available aspnet account in your sql. Create again an aspnet account in your sql choosing available accounts in your windows account, dont create aspnet account by typing aspnet yourself. just choose. Finally as you know, give this account necessary permissions you need to do your work in your database. I hope this will solve the problem :)

The Ghost of PC
[ Peace in country, peace in the world]

|||

Cannot open user default database

The user you set up does not have permissions on the database you set as the users default database.

|||

ghost,

I'm a real newbie. How do I look at groups in my windows? I have the same problem, only with some databases and not others.

dennist685

|||No offense but I kind of guessed that! If you see my message you'll see that I already added the user so that wasn't the problem.

I actually changed the way I connected to the database to:

Data Source=.\SQLEXPRESS;Initial Catalog=myDb;Integrated Security=True;

previously I was using:

Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|myDb.mdf

Now, here's the wiered thing. If I connect using the top method, it works and I'm connecting as machinename/ASPNET.

If I use the second connection string, I'm still connecting as machinename/ASPNET but the login fails.

So, if anyone can explain that, I'd be interested to know why it happens. I've set up machinename/ASPNET as a user so that ISN'T the problem as it lets me connect using the top connection string. It seems to be when I use the bottom method for connecting that I get the error even though I know that machinname/ASPNET is set up as a user on the database.

No comments:

Post a Comment