PC Review


Reply
Thread Tools Rate Thread

Trusted connection problem

 
 
MuZZY
Guest
Posts: n/a
 
      11th Sep 2004
Hi,

I wonder if someone can help me with the problem:
At work we have a network domain with a MS SQL Server box.
I am trying to connect to the server using ADO.NET in my asp.net page:

//----------------------------------------
SqlConnection con =
new SqlConnection( "Server=MYSERVER;Database=MYDATABASE;Integrated
Security=SSPI");

try
{
con.Open();
}
catch (SqlException ee) {return false;}
//-----------------------------------------

I have administrative rights on the domain, but when i try to connect i
get the exception. When i look in the ee.Message it says something like
"Access denied for user=null..."
So why i can't connect using trusted connection?
Do i need to set anything else as well?

By the way, IIS server i am using is on my machine and integrated
security is turned on there.
Also i don't have probelms connecting to the server thru Qyery Analyser
or Enterprise Manager using Windows Logon.

Any ideas would be highly appreciated!

Thank you in advance,
Andrey
 
Reply With Quote
 
 
 
 
MuZZY
Guest
Posts: n/a
 
      11th Sep 2004
MuZZY wrote:

> Hi,
>
> I wonder if someone can help me with the problem:
> At work we have a network domain with a MS SQL Server box.
> I am trying to connect to the server using ADO.NET in my asp.net page:
>
> //----------------------------------------
> SqlConnection con =
> new SqlConnection( "Server=MYSERVER;Database=MYDATABASE;Integrated
> Security=SSPI");
>
> try
> {
> con.Open();
> }
> catch (SqlException ee) {return false;}
> //-----------------------------------------
>
> I have administrative rights on the domain, but when i try to connect i
> get the exception. When i look in the ee.Message it says something like
> "Access denied for user=null..."
> So why i can't connect using trusted connection?
> Do i need to set anything else as well?
>
> By the way, IIS server i am using is on my machine and integrated
> security is turned on there.
> Also i don't have probelms connecting to the server thru Qyery Analyser
> or Enterprise Manager using Windows Logon.
>
> Any ideas would be highly appreciated!
>
> Thank you in advance,
> Andrey



Update: That's exactly the excepton message:

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

I can't understand where the problem comes from...
 
Reply With Quote
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      11th Sep 2004
Hi,

asp.net applications use aspnet local windows account (or networking service
on w2k3) and it won't work with integrated security.
Either use sql server security or change the <identity> node to run under
some other account.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"MuZZY" <(E-Mail Removed)> wrote in message
news:Mvw0d.152018$9d6.114749@attbi_s54...
> MuZZY wrote:
>
>> Hi,
>>
>> I wonder if someone can help me with the problem:
>> At work we have a network domain with a MS SQL Server box.
>> I am trying to connect to the server using ADO.NET in my asp.net page:
>>
>> //----------------------------------------
>> SqlConnection con =
>> new SqlConnection( "Server=MYSERVER;Database=MYDATABASE;Integrated
>> Security=SSPI");
>>
>> try
>> {
>> con.Open();
>> }
>> catch (SqlException ee) {return false;}
>> //-----------------------------------------
>>
>> I have administrative rights on the domain, but when i try to connect i
>> get the exception. When i look in the ee.Message it says something like
>> "Access denied for user=null..."
>> So why i can't connect using trusted connection?
>> Do i need to set anything else as well?
>>
>> By the way, IIS server i am using is on my machine and integrated
>> security is turned on there.
>> Also i don't have probelms connecting to the server thru Qyery Analyser
>> or Enterprise Manager using Windows Logon.
>>
>> Any ideas would be highly appreciated!
>>
>> Thank you in advance,
>> Andrey

>
>
> Update: That's exactly the excepton message:
>
> "Login failed for user '(null)'. Reason: Not associated with a trusted SQL
> Server connection."
> I can't understand where the problem comes from...



 
Reply With Quote
 
Pablo Castro [MS]
Guest
Posts: n/a
 
      14th Sep 2004
Have you checked that ASP.NET is actually impersonating the caller? (for
example, you can check what's returned by WindowsIdentity.GetCurrent())

Also, if the client, the webserver and the database server are in 3 separate
computers, this won't work without making some changes. The problem is that
when you use integrated security, by default Windows will not allow
applications to pass security identities across computers for more than one
hop; so if you have 3 computers in your scenario (which is actually the
typical scenario), you can pass the identity from the client computer (where
the browser is running) to the web server, but then you cannot do another
hop from there to the database.

There is a mechanism called "delegation" that enables you to do that, but
requires specific configuration steps. You can find more information at
http://support.microsoft.com/default...b;en-us;810572

--
Pablo Castro
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.


"MuZZY" <(E-Mail Removed)> wrote in message
news:Mvw0d.152018$9d6.114749@attbi_s54...
> MuZZY wrote:
>
> > Hi,
> >
> > I wonder if someone can help me with the problem:
> > At work we have a network domain with a MS SQL Server box.
> > I am trying to connect to the server using ADO.NET in my asp.net page:
> >
> > //----------------------------------------
> > SqlConnection con =
> > new SqlConnection( "Server=MYSERVER;Database=MYDATABASE;Integrated
> > Security=SSPI");
> >
> > try
> > {
> > con.Open();
> > }
> > catch (SqlException ee) {return false;}
> > //-----------------------------------------
> >
> > I have administrative rights on the domain, but when i try to connect i
> > get the exception. When i look in the ee.Message it says something like
> > "Access denied for user=null..."
> > So why i can't connect using trusted connection?
> > Do i need to set anything else as well?
> >
> > By the way, IIS server i am using is on my machine and integrated
> > security is turned on there.
> > Also i don't have probelms connecting to the server thru Qyery Analyser
> > or Enterprise Manager using Windows Logon.
> >
> > Any ideas would be highly appreciated!
> >
> > Thank you in advance,
> > Andrey

>
>
> Update: That's exactly the excepton message:
>
> "Login failed for user '(null)'. Reason: Not associated with a trusted
> SQL Server connection."
>
> I can't understand where the problem comes from...



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not associated with a trusted SQL connection??? =?Utf-8?B?QW5kcmV3?= Microsoft ADO .NET 8 2nd Nov 2005 11:00 PM
Database Connection - Not Associated With Trusted Connection Mythran Microsoft ASP .NET 5 6th Oct 2005 12:50 AM
how to set trusted connection? florence Microsoft Windows 2000 Setup 1 28th Oct 2003 05:02 PM
trusted sql server connection problem!? Brian Henry Microsoft ADO .NET 5 15th Oct 2003 09:33 PM
trusted sql server connection problem!? Brian Henry Microsoft ASP .NET 5 15th Oct 2003 09:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:21 PM.