It is currently Thu Mar 28, 2024 7:21 pm



Reply to topic  [ 3 posts ] 
Using NT Authentication for IIS and MS-SQL Server 
Author Message
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 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.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Tue Oct 10, 2006 8:21 am
Profile WWW
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
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.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Thu Oct 12, 2006 6:54 am
Profile WWW
Felix Rex
User avatar

Joined: Fri Mar 28, 2003 6:01 pm
Posts: 16646
Location: On a slope
Reply with quote
Post 
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.

_________________
They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.


Thu Oct 12, 2006 7:01 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.