deNZity
asked on
Login failed for user ' '. The user is not associated with a trusted SQL Server connection.
I have a website on intranet that tracks equipment. When in debug mode I get this error msg when logging in...
Login failed for user ' '. The user is not associated with a trusted SQL Server connection.
I can login with same username pwd when I access site through web browser, it is only in debug mode that there is a problem.
win xp
ms vstudio
server
ms server 2003
IIS
sql server 2005
Login failed for user ' '. The user is not associated with a trusted SQL Server connection.
I can login with same username pwd when I access site through web browser, it is only in debug mode that there is a problem.
win xp
ms vstudio
server
ms server 2003
IIS
sql server 2005
What does your connection string look like? You can remove any sensitive information before you post it.
To change the authentication mode from Windows Authentication to Mixed Mode, use either of the following steps:
Using the Database Maintenance Wizard:
1.) Select 'Switch Server Security Mode'
2.) Choose the correct SQL server and database if necessary
3.) Specify the option for 'SQL Server and Windows'
4.) Click 'Next', then 'Finish'
5.) Restart SQL Server in order for the change to take effect.
OR
Using the SQL Enterprise Manager:
1.) Expand a Server group.
2.) Right-click a server name, and then click Properties.
3.) Click the Security tab.
4.) Under Authentication, click the SQL Server and Windows option button.
5.) Restart SQL Server in order for the change to take effect.
Ref: http://www.scriptlogic.com/support/kb/displayarticle.asp?UID=564
Using the Database Maintenance Wizard:
1.) Select 'Switch Server Security Mode'
2.) Choose the correct SQL server and database if necessary
3.) Specify the option for 'SQL Server and Windows'
4.) Click 'Next', then 'Finish'
5.) Restart SQL Server in order for the change to take effect.
OR
Using the SQL Enterprise Manager:
1.) Expand a Server group.
2.) Right-click a server name, and then click Properties.
3.) Click the Security tab.
4.) Under Authentication, click the SQL Server and Windows option button.
5.) Restart SQL Server in order for the change to take effect.
Ref: http://www.scriptlogic.com/support/kb/displayarticle.asp?UID=564
ASKER
thanks for the replies,
Here is my connection string from web config.
<add name="LoansConnectionStrin g" connectionString="Data Source=SQLDEV2;Initial Catalog=Loans;Integrated Security=True"
providerName="System.Data. SqlClient" />
Here is my connection string from web config.
<add name="LoansConnectionStrin
providerName="System.Data.
ASKER
ryancys: mixed mode was already enabled, I had been able to logon in debug mode until I uninstalled reinstalled server extensions 2002
ASKER
this section:
Using VB.NET:
Imports System.Data.SqlClient
...
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString = _
"Data Source=(local);" & _
"Initial Catalog=myDatabaseName;" & _
"Integrated Security=SSPI"
oSQLConn.Open()
is more or less what I have except integrated security = true not 'SSPI'
Using VB.NET:
Imports System.Data.SqlClient
...
Dim oSQLConn As SqlConnection = New SqlConnection()
oSQLConn.ConnectionString = _
"Data Source=(local);" & _
"Initial Catalog=myDatabaseName;" & _
"Integrated Security=SSPI"
oSQLConn.Open()
is more or less what I have except integrated security = true not 'SSPI'
I'm guessing you're trying to use a trusted connection user. Make sure the user you want to connect to the database with is the anonymous user in IIS and that that user can log into the database and has appropriate permissions. In you web.config in the <system.web></system.web> section add the tag <identity impersonate="true" /> this tells .Net to run under the context of the anonymous user.
http://idunno.org/articles/276.aspx
http://idunno.org/articles/276.aspx
ASKER
Hi crisco96 thanks for the suggestion unfortunately it made no difference.
"Make sure the user you want to connect to the database with is the anonymous user in IIS and that that user can log into the database and has appropriate permissions."
How can I tell if its the anonymous user in IIS that I'm using? and that he has permissons?
The error msg says "Login failed for user ' '. " there is not a username between the ' '
"Make sure the user you want to connect to the database with is the anonymous user in IIS and that that user can log into the database and has appropriate permissions."
How can I tell if its the anonymous user in IIS that I'm using? and that he has permissons?
The error msg says "Login failed for user ' '. " there is not a username between the ' '
ASKER
I should have said, both sqlserver 2005 and IIS are running on the same server.
First did you put the <identity impersonate="true" /> tag in your system.web section in your web.config? And are you using .net 2.0?
ASKER
Yes to...
"did you put the <identity impersonate="true" /> tag in your system.web section in your web.config"
Version
asp.net 2.0
"did you put the <identity impersonate="true" /> tag in your system.web section in your web.config"
Version
asp.net 2.0
ASKER
I am now getting this error .. Exception Details: System.Data.SqlClient.SqlE xception: Login failed for user 'SQLDEV2\IUSR_SQLDEV2'.
when I try to logon
This site is supposed to use the NETWORK SERVICE for all access to db
when I try to logon
This site is supposed to use the NETWORK SERVICE for all access to db
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.