Showing posts with label errorcannot. Show all posts
Showing posts with label errorcannot. Show all posts

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.

Wednesday, March 7, 2012

Please read this, I need Help!

Hi!

Can You tell me how can i fix this error:

Cannot open database "DiaulusSimple" requested by the login. The login failed.
Login failed for user 'DIAULUS\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Cannot open database "DiaulusSimple" requested by the login. The login failed.
Login failed for user 'DIAULUS\ASPNET'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

I am using ASP.NET, SQLServer2005, Visual Studio 2005

I imagine you are using integrated security - that is, you are not passing in a SQL Server username and password (you need to show us your connection string). Presuming that is the case, you need to add the Windows ASPNET user as a user in SQL Server.|||

This is my connection string:

Data Source=diaulus;Initial Catalog=DiaulusSimple;Integrated Security=True

If I use SQL Server Authentication I get this error:

Login faild for user "<user name>". The user is not associated with a trusted SQL connection.

MSDN Library for Visual Studio 2005 has some text about this, but it's about SQL Server 2000, and some Enterprise Menager, that I don't have

|||For the login failure of SQL Authentication, make sure the SQL Server is configured to use mixed authentication mode (both Windows and SQL Authentication), and you have the SQL account in SQL logins. You can check the Authentication Mode in Enterprise Manager->right click the SQL instance->choose Properties->switch to Security tab.|||

How can I startENTERPRISE MANAGER?

I don't have it any where

|||

In SQL Server 2005, it is SQL Server Management Studio.