Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Login failed for user '\'

Reply
Thread Tools

Login failed for user '\'

 
 
Karl S.
Guest
Posts: n/a
 
      08-23-2005
I'm at a loss to what the solution is. I have an intranet application that
runs on w2k3 with iis 6.0 security set to Integrated Windows authentication
only. I am using C# in .NET 2003 (7.1.308 w/ Framework 1.1 (1.1.4322 SP1).
The web.config authentication mode="Windows" and authorization set to <allow
users="*" />.
This app is trying to connect to SQL 7.0 on an NT server in the same domain.
I currently have a web service running on the same w2k3 web server that
accesses this same SQL Server but uses anonymous access (set to a domain
user) and it connects just fine. Here's a stripped down version of the
routine that throws the exception.

private DataTable getData()
{
SqlConnection conn = new SqlConnection ("server=ntServer;database=myDB;
Integrated
Security=SSPI");
conn.Open(); <--------- throws SqlException
....
}

When I use WindowsPrincipal.Identity.Name.ToString() to see who this .NET
app is being ran as, it comes back with the correct domain\username that has
proper access to the database (I even used the domain admin account). But
the SQL Error message is saying "Login failed for user'\'". I tried setting
the authentication mode to anonymous and use the same user and SqlConnection
as my web service but I get the same error message. I've got to be missing
something but what?

Please help.

 
Reply With Quote
 
 
 
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      08-23-2005
Hello Karl S.,

do you have impersonation enabled??

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> I'm at a loss to what the solution is. I have an intranet application
> that
> runs on w2k3 with iis 6.0 security set to Integrated Windows
> authentication
> only. I am using C# in .NET 2003 (7.1.308 w/ Framework 1.1
> (1.1.4322 SP1).
> The web.config authentication mode="Windows" and authorization set to
> <allow
> users="*" />.
> This app is trying to connect to SQL 7.0 on an NT server in the same
> domain.
> I currently have a web service running on the same w2k3 web server
> that
> accesses this same SQL Server but uses anonymous access (set to a
> domain
> user) and it connects just fine. Here's a stripped down version of
> the routine that throws the exception.
>
> private DataTable getData()
> {
> SqlConnection conn = new SqlConnection
> ("server=ntServer;database=myDB;
>
> Integrated
> Security=SSPI");
> conn.Open(); <--------- throws SqlException
> ...
> }
> When I use WindowsPrincipal.Identity.Name.ToString() to see who this
> .NET app is being ran as, it comes back with the correct
> domain\username that has proper access to the database (I even used
> the domain admin account). But the SQL Error message is saying "Login
> failed for user'\'". I tried setting the authentication mode to
> anonymous and use the same user and SqlConnection as my web service
> but I get the same error message. I've got to be missing something
> but what?
>
> Please help.
>




 
Reply With Quote
 
 
 
 
Karl S.
Guest
Posts: n/a
 
      08-23-2005
Hi Dominick,

I do have <identity impersonate="true" /> set in the web.config file. It
does seem like it isn't taking though. Any thoughts on how to verify it?

~Karl

"Dominick Baier [DevelopMentor]" wrote:

> Hello Karl S.,
>
> do you have impersonation enabled??
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
> > I'm at a loss to what the solution is. I have an intranet application
> > that
> > runs on w2k3 with iis 6.0 security set to Integrated Windows
> > authentication
> > only. I am using C# in .NET 2003 (7.1.308 w/ Framework 1.1
> > (1.1.4322 SP1).
> > The web.config authentication mode="Windows" and authorization set to
> > <allow
> > users="*" />.
> > This app is trying to connect to SQL 7.0 on an NT server in the same
> > domain.
> > I currently have a web service running on the same w2k3 web server
> > that
> > accesses this same SQL Server but uses anonymous access (set to a
> > domain
> > user) and it connects just fine. Here's a stripped down version of
> > the routine that throws the exception.
> >
> > private DataTable getData()
> > {
> > SqlConnection conn = new SqlConnection
> > ("server=ntServer;database=myDB;
> >
> > Integrated
> > Security=SSPI");
> > conn.Open(); <--------- throws SqlException
> > ...
> > }
> > When I use WindowsPrincipal.Identity.Name.ToString() to see who this
> > .NET app is being ran as, it comes back with the correct
> > domain\username that has proper access to the database (I even used
> > the domain admin account). But the SQL Error message is saying "Login
> > failed for user'\'". I tried setting the authentication mode to
> > anonymous and use the same user and SqlConnection as my web service
> > but I get the same error message. I've got to be missing something
> > but what?
> >
> > Please help.
> >

>
>
>
>

 
Reply With Quote
 
Karl S.
Guest
Posts: n/a
 
      08-24-2005
Looks like I was wrong about the below statement.

> ... I tried setting
> the authentication mode to anonymous and use the same user and SqlConnection
> as my web service but I get the same error message. ...


When I set the authentication mode to anonymous and use the same username as
my web service, it works. It appears that using "Integrated Windows
authentication" only is why it is failing for me. What do I need to do to
get this to work?
 
Reply With Quote
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      08-24-2005
Hello Karl S.,

so you are trying to access a back end resource using impersonated credentials.
this is called delegation and has to be configured.

have a look at:
http://www.leastprivilege.com/Troubl...elegation.aspx


---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> Hi Dominick,
>
> I do have <identity impersonate="true" /> set in the web.config
> file. It does seem like it isn't taking though. Any thoughts on how
> to verify it?
>
> ~Karl
>
> "Dominick Baier [DevelopMentor]" wrote:
>
>> Hello Karl S.,
>>
>> do you have impersonation enabled??
>>
>> ---------------------------------------
>> Dominick Baier - DevelopMentor
>> http://www.leastprivilege.com
>>> I'm at a loss to what the solution is. I have an intranet
>>> application
>>> that
>>> runs on w2k3 with iis 6.0 security set to Integrated Windows
>>> authentication
>>> only. I am using C# in .NET 2003 (7.1.308 w/ Framework 1.1
>>> (1.1.4322 SP1).
>>> The web.config authentication mode="Windows" and authorization set
>>> to
>>> <allow
>>> users="*" />.
>>> This app is trying to connect to SQL 7.0 on an NT server in the same
>>> domain.
>>> I currently have a web service running on the same w2k3 web server
>>> that
>>> accesses this same SQL Server but uses anonymous access (set to a
>>> domain
>>> user) and it connects just fine. Here's a stripped down version of
>>> the routine that throws the exception.
>>> private DataTable getData()
>>> {
>>> SqlConnection conn = new SqlConnection
>>> ("server=ntServer;database=myDB;
>>> Integrated
>>> Security=SSPI");
>>> conn.Open(); <--------- throws SqlException
>>> ...
>>> }
>>> When I use WindowsPrincipal.Identity.Name.ToString() to see who this
>>> .NET app is being ran as, it comes back with the correct
>>> domain\username that has proper access to the database (I even used
>>> the domain admin account). But the SQL Error message is saying
>>> "Login
>>> failed for user'\'". I tried setting the authentication mode to
>>> anonymous and use the same user and SqlConnection as my web service
>>> but I get the same error message. I've got to be missing something
>>> but what?
>>> Please help.
>>>




 
Reply With Quote
 
Paul Clement
Guest
Posts: n/a
 
      08-24-2005
On Tue, 23 Aug 2005 17:07:03 -0700, "Karl S." <> wrote:

¤ Looks like I was wrong about the below statement.
¤
¤ > ... I tried setting
¤ > the authentication mode to anonymous and use the same user and SqlConnection
¤ > as my web service but I get the same error message. ...
¤
¤ When I set the authentication mode to anonymous and use the same username as
¤ my web service, it works. It appears that using "Integrated Windows
¤ authentication" only is why it is failing for me. What do I need to do to
¤ get this to work?

You need to configure your environment for Kerberos as Dominick referred to in his last reply.

IIS cannot delegate credentials to remote resources when Integrated Windows Authentication has been
implemented.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Reply With Quote
 
Karl S.
Guest
Posts: n/a
 
      08-24-2005
Thank you for steering me in the right direction. I'll check it out.

"Dominick Baier [DevelopMentor]" wrote:

> Hello Karl S.,
>
> so you are trying to access a back end resource using impersonated credentials.
> this is called delegation and has to be configured.
>
> have a look at:
> http://www.leastprivilege.com/Troubl...elegation.aspx
>
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
> > Hi Dominick,
> >
> > I do have <identity impersonate="true" /> set in the web.config
> > file. It does seem like it isn't taking though. Any thoughts on how
> > to verify it?
> >
> > ~Karl
> >
> > "Dominick Baier [DevelopMentor]" wrote:
> >
> >> Hello Karl S.,
> >>
> >> do you have impersonation enabled??
> >>
> >> ---------------------------------------
> >> Dominick Baier - DevelopMentor
> >> http://www.leastprivilege.com
> >>> I'm at a loss to what the solution is. I have an intranet
> >>> application
> >>> that
> >>> runs on w2k3 with iis 6.0 security set to Integrated Windows
> >>> authentication
> >>> only. I am using C# in .NET 2003 (7.1.308 w/ Framework 1.1
> >>> (1.1.4322 SP1).
> >>> The web.config authentication mode="Windows" and authorization set
> >>> to
> >>> <allow
> >>> users="*" />.
> >>> This app is trying to connect to SQL 7.0 on an NT server in the same
> >>> domain.
> >>> I currently have a web service running on the same w2k3 web server
> >>> that
> >>> accesses this same SQL Server but uses anonymous access (set to a
> >>> domain
> >>> user) and it connects just fine. Here's a stripped down version of
> >>> the routine that throws the exception.
> >>> private DataTable getData()
> >>> {
> >>> SqlConnection conn = new SqlConnection
> >>> ("server=ntServer;database=myDB;
> >>> Integrated
> >>> Security=SSPI");
> >>> conn.Open(); <--------- throws SqlException
> >>> ...
> >>> }
> >>> When I use WindowsPrincipal.Identity.Name.ToString() to see who this
> >>> .NET app is being ran as, it comes back with the correct
> >>> domain\username that has proper access to the database (I even used
> >>> the domain admin account). But the SQL Error message is saying
> >>> "Login
> >>> failed for user'\'". I tried setting the authentication mode to
> >>> anonymous and use the same user and SqlConnection as my web service
> >>> but I get the same error message. I've got to be missing something
> >>> but what?
> >>> Please help.
> >>>

>
>
>
>

 
Reply With Quote
 
Karl S.
Guest
Posts: n/a
 
      08-24-2005
Thanks Paul.

"Paul Clement" wrote:

> On Tue, 23 Aug 2005 17:07:03 -0700, "Karl S." <> wrote:
>
> ¤ Looks like I was wrong about the below statement.
> ¤
> ¤ > ... I tried setting
> ¤ > the authentication mode to anonymous and use the same user and SqlConnection
> ¤ > as my web service but I get the same error message. ...
> ¤
> ¤ When I set the authentication mode to anonymous and use the same username as
> ¤ my web service, it works. It appears that using "Integrated Windows
> ¤ authentication" only is why it is failing for me. What do I need to do to
> ¤ get this to work?
>
> You need to configure your environment for Kerberos as Dominick referred to in his last reply.
>
> IIS cannot delegate credentials to remote resources when Integrated Windows Authentication has been
> implemented.
>
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Cannot open user default database. Login failed. Login failed for user 'HEMPC\ASPNET' Tony Johansson ASP .Net 3 01-02-2010 04:09 PM
Cannot open database requested in login 'HumanResources'. Login failed for user 'companyDomain\BOSIIS$'. Homer ASP .Net 3 09-25-2007 07:45 PM
Error:Login failed for user ''. The user is not associated with a trusted SQL Server connection. CFTK ASP .Net 5 01-09-2007 10:51 AM
Login failed for user ''. The user is not associated with a trusted SQL Server connection. Dennis ASP .Net 0 06-26-2006 03:55 PM
Login failed for user ''. The user is not associated with a truste =?Utf-8?B?U3lsdmFu?= ASP .Net 4 11-26-2005 04:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57