Click here to Skip to main content
14,363,648 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello. I developed a asp.net web site and it works on localhost. I can connect mssql with remote . Bu it writes Login failde for User 'sa'. I didn't write 'sa' to anywhere in my application. I don't know why i get this error.
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

You must have a connection string somewhere or else you can never access SQL. It is likely in your web.config.
   
Comments
enoua 25-Aug-14 10:17am
   
Yes I have a connectionstring in web.config . Also i have a connectionstring in a class. But they are not for user sa .
ZurdoDev 25-Aug-14 10:20am
   
Somewhere it is using sa. You'll have to find it. We can't see your code.
enoua 25-Aug-14 10:31am
   
I developed my application on visual studio 2010 but my server is windows server 2003 (IIS6) is this problem ?
ZurdoDev 25-Aug-14 10:34am
   
Shouldn't be. IIS will use the App pool identity if you specify Integrated Security in your connection string but that would also mean the app pool is using an account named SA which would be really weird.

Just trace it and see what line of code is throwing the error. Then find out where the connection string is getting set.

Or, just search for "SA" matching on whole words and see what it finds.
enoua 25-Aug-14 10:48am
   
add name="websitesiConnectionString" connectionstring="Server=xx.xxx.xxx.xxx; Database=my_db_name;User ID=my_user_name;Password=my_password;" /add (I removed < and > tags)
here is my connectionstring . It works on remote connection from my localhost . But it gives me
Login failed for user 'sa'.

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 'sa'.
ZurdoDev 25-Aug-14 10:54am
   
Because it is trying to login with sa. You have it somewhere.
enoua 25-Aug-14 10:56am
   
not in my application i am sure. I think it is for server. But don't know how can i solve ...
ZurdoDev 25-Aug-14 10:59am
   
It's your code that is failing. It is your code that is trying to connect to the server and failing.

Did you search for SA in your entire solution?
Rate this:
Please Sign up or sign in to vote.

Solution 3

It was a compatibility problem with framework, sql server 2008 R2 and windows server 2003. After installing windows server 2008 the problem was solved.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100