ClanKiller.com
http://forums.clankiller.com/

Using NT Authentication for IIS and MS-SQL Server
http://forums.clankiller.com/viewtopic.php?f=24&t=2009
Page 1 of 1

Author:  Satis [ Tue Oct 10, 2006 8:21 am ]
Post subject:  Using NT Authentication for IIS and MS-SQL Server

ok... just found this tut and it got me working on a project I'm working on for my work. This shows how to set IIS to authenticate as any domain user for use of NT Authentication for trusted connections. In my case, I had MS-SQL server against my domain username instead of IIS's default username and had to switch IIS to use my account for a specific web folder.

http://idunno.org/dotNet/trustedConnections.aspx

if you don't understand a word of that, don't worry about it.

Author:  Satis [ Thu Oct 12, 2006 6:54 am ]
Post subject: 

ok...and now the authentication method completely fails. The error message is as follows:

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

I set up the trusted connection string in my web.config file:

[php]

<appSettings>
<add key="SQL_NT"
value="Provider=SQLOLEDB; Data Source=sql-server;
Initial Catalog=Test_database; Integrated Security=SSPI; Trusted_Connection=yes;" />
</appSettings>

[/php]

I then call it in my app_code class as follows:

[php]

OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.AppSettings.Get("SQL_NT"));
conn.Open();

[/php]

The conn.Open() generates the authentication failure. This same string was working yesterday. As part of hte previous fix, I went into the IIS admin and change directory security to authenticate anonymous users as my domain login.

The problem is I don't control the domain and I don't control the SQL server. If I controlled the SQL server, I'd just allow mixed logins and use SQL authentication. I don't know if something was changed on my domain llogin that suddenly broke this authentication. It's very frustrating as it's frozen my web development in its tracks.

I'm currently tracking down ASP.NET event log errors in the hope I'll find a root cause.

Author:  Satis [ Thu Oct 12, 2006 7:01 am ]
Post subject: 

ok, I figured it out. As part of a session problem I was having, it looks like I jacked up my web.config file. By "jacked up" I mean I removed one line that I shouldn't have, specifically:

[php]<identity impersonate="true"/>[/php]

This allows asp.net to run as me instead of as the asp.net user, thus allowing nt authentication to run properly. :roll: Go me.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/