RE: Connect to SQL Server database results in: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
From: Jim Cheshire [MSFT] (jamesche_at_online.microsoft.com)
Date: 03/22/04
- Next message: Wes Henderson: "Re: How can I get current role name???"
- Previous message: Wes Henderson: "Re: Forms authentication problems"
- In reply to: Marc A. Michaels: "Connect to SQL Server database results in: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Mon, 22 Mar 2004 18:33:00 GMT
Marc,
You are experiencing this problem because you are attempting to delegate
credentials and delegation is not configured. If you are not using
delegation (the default scenario), Windows Integrated authentication will
use NTLM authentication, and NTLM is designed so that credentials cannot be
delegated. You'll often hear people refer to this as the "double hop"
issue.
To resolve this, you will need to set up delegation and use Kerberos
authentication. Alternatively, you could use Basic authentication or use
SQL Server authentication to the database as opposed to Windows
authentication.
Here's an article on using Kerberos authentication.
810572 HOW TO: Configure an ASP.NET Application for a Delegation Scenario
http://support.microsoft.com/?id=810572
Hope that helps.
Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support Engineer
jamesche@online.microsoft.com
This post is provided "AS-IS" with no warranties and confers no rights.
--------------------
>Thread-Topic: Connect to SQL Server database results in: Login failed for
user '(null)'. Reason: Not associated with a trusted SQL Server connection.
>thread-index: AcQQKmENm4fz97mqRvCxeSKJFjnKOA==
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
>From: "=?Utf-8?B?TWFyYyBBLiBNaWNoYWVscw==?="
<anonymous@discussions.microsoft.com>
>Subject: Connect to SQL Server database results in: Login failed for user
'(null)'. Reason: Not associated with a trusted SQL Server connection.
>Date: Mon, 22 Mar 2004 08:26:07 -0800
>Lines: 20
>Message-ID: <D0E920E3-AD71-49E6-A916-309E6E8C27A4@microsoft.com>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="Utf-8"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>Content-Class: urn:content-classes:message
>Importance: normal
>Priority: normal
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
>Newsgroups: microsoft.public.dotnet.framework.aspnet.security
>Path: cpmsftngxa06.phx.gbl
>Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.aspnet.security:9253
>NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.security
>
>Hi all,
I've been scouring the newsgroups hoping to find an answer here. I have an
site in IIS that uses integrated authentication. When I run my code on my
development machine, it works. When I post the code to my webserver, I get
the subject named error. If I physically go to my webserver machine and
attempt to load the web page, it works fine. When I try to access the same
web page from a remote browser, I get the subject named error.
My web.config file looks like this:
<authentication mode="Windows" /><identity
impersonate="true"/><authorization><allow users="*" /><deny users="?"
/></authorization>
My connection string looks like this:
dbConn.ConnectionString = "packet size=4096;integrated
security=SSPI;data source=MYSERVER_SQL;persist security info=False;initial
catalog=CentralInformation;Trusted_Connection=yes"
I verified the user attempting to log into the database by coding:
UserID = thread.CurrentPrincipal.Identity.Name
I even went so far as to hold off on any database connections until after
the page loaded. I created a button that showed
thread.CurrentPrincipal.Identity.Name as the text (to ensure that my system
was reading the correct windows account and not some default ASPNET
account). I then tried to make the database connection by clicking the
button. This attempt failed with the same results.
My SQL server database is NOT located on the same machine as IIS. I need
separate windows accounts accessing the database because I intend to
implement column level security.
Am I making any sense?
Thanks in advance!
Marc
>
- Next message: Wes Henderson: "Re: How can I get current role name???"
- Previous message: Wes Henderson: "Re: Forms authentication problems"
- In reply to: Marc A. Michaels: "Connect to SQL Server database results in: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]