Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Login failed for user

Status
Not open for further replies.

dpdoug

Programmer
Nov 27, 2002
455
US
I'm trying to connect to a local SQL Server DB the project I am developing. I'm using the following connection string:

Initial Catalog=reqsql;Data Source=DEV;Integrated Security=SSPI

where DEV is the name of my local pc. I've also tried using Data Source=(local) instead of Data Source=DEV.

But I get the following error:

Code:
Login failed for user 'DEV\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: Login failed for user 'DEV\ASPNET'.

I can log in to the same db using an access adp and VB6 with no problem using integrated windows security - but not for ASP.NET.

Does anybody have a clue to what the problem is?

David
 
dp: shot in the dark - cd it be related to map path?
 
Isadore,

I put this line in the Web.config file:
Code:
<identity impersonate="true" userName="myusername" password="mypassword"/>
and that did the trick!!

Thanks for the consideration though.

David
 
dpdoug -

By changing the <identity> tag in the web.config, your whole application will run under that user instead of the asp.net worker account.

To avoid this, try connecting to your SQL server like this:

Code:
SqlConnection con = new SqlConnection("server=locahost;uid=userName;password=password;inital catalog=dbName;");

This is the connection method that I (and most other developers who have written articles about this) use as a standard.

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
I tried that and it gave me the error:

SQL Server does not exist or access denied
 
Use the machine name or IP address instead of localhost then.

-----------------------------------------------
"The night sky over the planet Krikkit is the least interesting sight in the entire universe."
-Hitch Hiker's Guide To The Galaxy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top