473,748 Members | 2,294 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows authentication/impersonation.. login failed for user null?

Hey,

We have an sql server 2000 machine and IIS 6 machine running seperately
but on the same domain. I can connect fine to the database without using
impersonation, but when it's enabled I get the error:
"Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection."

When I check System.Security .Principal.Wind owsIdentity.Get Current().Name I
get the valid domain user that I would expect, why isn't this user being
checked against the sql server?

cheers for any help,
Chris
Dec 19 '06 #1
6 12775
You must make sure that domain user account or the domain security group
(that domain user account is in) ia mapped to a SQL server login/Sql Server
database user. That is, not all domain user account is automatically allowed
to access SQL Server, you need to explicitly create SQL Server login that
maps to a domain group/user, and then make specific SQL Server login as
given database's user/owner...
"Not Me" <No****@nada.no pe.hk.zawrote in message
news:11******** *******@ucsnew2 .ncl.ac.uk...
Hey,

We have an sql server 2000 machine and IIS 6 machine running seperately
but on the same domain. I can connect fine to the database without using
impersonation, but when it's enabled I get the error:
"Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection."

When I check System.Security .Principal.Wind owsIdentity.Get Current().Name I
get the valid domain user that I would expect, why isn't this user being
checked against the sql server?

cheers for any help,
Chris

Dec 19 '06 #2
You must make sure that domain user account or the domain security group
(that domain user account is in) ia mapped to a SQL server login/Sql Server
database user. That is, not all domain user account is automatically allowed
to access SQL Server, you need to explicitly create SQL Server login that
maps to a domain group/user, and then make specific SQL Server login as
given database's user/owner...
"Not Me" <No****@nada.no pe.hk.zawrote in message
news:11******** *******@ucsnew2 .ncl.ac.uk...
Hey,

We have an sql server 2000 machine and IIS 6 machine running seperately
but on the same domain. I can connect fine to the database without using
impersonation, but when it's enabled I get the error:
"Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection."

When I check System.Security .Principal.Wind owsIdentity.Get Current().Name I
get the valid domain user that I would expect, why isn't this user being
checked against the sql server?

cheers for any help,
Chris

Dec 19 '06 #3
SAL
Chris, I just, agonizingly, went through this same scenario. Here was my
problem.

In IIS, I opened the properties of my web application and I had to change
the default user (on the Directory Security Tab) that was entered there to
my domain account (or some other user's domain account that could log on to
the machine that SQL Server was residing on). Then I had to uncheck the Let
IIS manage the password checkbox and enter in my own password. I had to
leave Integrated Windows Authentication checked.
In my web.config, I had to have this tag:

<identity impersonate="tr ue" />

When publishing, I believe I had to uncheck the Integrated Windows
Authentication to make it work on machines other than my dev box.

HTH
S

"Not Me" <No****@nada.no pe.hk.zawrote in message
news:11******** *******@ucsnew2 .ncl.ac.uk...
Hey,

We have an sql server 2000 machine and IIS 6 machine running seperately
but on the same domain. I can connect fine to the database without using
impersonation, but when it's enabled I get the error:
"Login failed for user '(null)'. Reason: Not associated with a trusted SQL
Server connection."

When I check System.Security .Principal.Wind owsIdentity.Get Current().Name I
get the valid domain user that I would expect, why isn't this user being
checked against the sql server?

cheers for any help,
Chris

Dec 19 '06 #4
"Norman Yuan" <No*****@NotRea l.notwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
You must make sure that domain user account or the domain security group
(that domain user account is in) ia mapped to a SQL server login/Sql
Server database user. That is, not all domain user account is
automatically allowed to access SQL Server, you need to explicitly create
SQL Server login that maps to a domain group/user, and then make specific
SQL Server login as given database's user/owner...
Thanks for the help Norman.. I'm still a bit confused though (I need to
explain this to the admins for them to make the changes).

I have an account made up on the sql server, for the security group that I
expect the users to reside in. This isn't an sql server login though, does
it need to be?

If I turn off impersonation, and have the username set up in IIS directly..
it works, it's just when I want to pass the credentials of whoever is logged
into the machine, via IIS/ASP to the SQL server, that it breaks.

cheers,
Chris
Dec 20 '06 #5
"SAL" <SA**@NoNo.comw rote in message
news:Oh******** ******@TK2MSFTN GP02.phx.gbl...
Chris, I just, agonizingly, went through this same scenario. Here was my
problem.

In IIS, I opened the properties of my web application and I had to change
the default user (on the Directory Security Tab) that was entered there to
my domain account (or some other user's domain account that could log on
to the machine that SQL Server was residing on). Then I had to uncheck the
Let IIS manage the password checkbox and enter in my own password. I had
to leave Integrated Windows Authentication checked.
In my web.config, I had to have this tag:

<identity impersonate="tr ue" />

When publishing, I believe I had to uncheck the Integrated Windows
Authentication to make it work on machines other than my dev box.
Thanks SAL, I'll also pass this to the admins to see if we can work it out.

cheers,
Chris

Dec 20 '06 #6
You need to know which user account on the IIS computer is used to run you
ASP.NET APP (you should know that, as ASP.NET app developer, so you can make
sure your ASPP.NET app runs within the security scope you expected).

Since ASP.NET runs on top of IIS, both IIS configuration and ASP.NET
configuration take place here.

Assume you use Windows Authentication in your ASP.NET (by default). If you
set "impersonat e" to true, then the user account running your asp.net app
is determined by if your IIS/App virtue directory allows anonymous access.
If yes, the user account would be the default IIS running account
(IUser_MNachine Name, by default, or the account you entered directly into
the IIS, as you described); if not, the ASP.NET app will "impersonat e" to
the user who requests the ASP.NET. If you do not use "impersonat e", the
APS.NET running account would be ASPNET or Network Service .

So, you really need to

1. As app developer, have clear idea which user account is designed/expected
to run your asp.net app. You need to consider do the configarations in both
IIS and your ASP.NET's web.config, so that the user account used is safe to
the server/network.

2. Once you know which user account (it can be a local account in the IIS
server, or a domain user account), you can configure the SQL Server to give
that account appropriate access.

"Not Me" <No****@nada.no pe.hk.zawrote in message
news:11******** *******@ucsnew2 .ncl.ac.uk...
"Norman Yuan" <No*****@NotRea l.notwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
>You must make sure that domain user account or the domain security group
(that domain user account is in) ia mapped to a SQL server login/Sql
Server database user. That is, not all domain user account is
automaticall y allowed to access SQL Server, you need to explicitly create
SQL Server login that maps to a domain group/user, and then make specific
SQL Server login as given database's user/owner...

Thanks for the help Norman.. I'm still a bit confused though (I need to
explain this to the admins for them to make the changes).

I have an account made up on the sql server, for the security group that I
expect the users to reside in. This isn't an sql server login though,
does it need to be?

If I turn off impersonation, and have the username set up in IIS
directly.. it works, it's just when I want to pass the credentials of
whoever is logged into the machine, via IIS/ASP to the SQL server, that it
breaks.

cheers,
Chris


Dec 20 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2423
by: Kristof Despiere | last post by:
Suppose you have one domain, filled with a couple of users. What needs to be done now is I need to start a windows application from a webform by pressing a button on the webform (for example). The problem is that the user who "owns" the service is always the ASPNET account. That's not good since you don't see the actual application (because it's owned by ASPNET). I've tried changed the processmodel section in the machine.config file to...
1
1748
by: Thomas Scheiderich | last post by:
I am having a problem connecting to an Sql Server using Windows Authentication. I am using the following command: server=Raptor;uid=tfs;password=tol1ee;database=ABC;Network Library =dbmssocn This works fine if Sql Server is set up as Sql and Windows Authentication. If I change the Sql Server to Windows Authentication, I get the following page:
5
2698
by: pberna | last post by:
Dear all, I built a Web Form application to start and stop a Windows Service remotely. I successful tested the application on Windows 2000 server + IIS. I must include the ASPNET user to the Administration group (on server side) to have the necessary authorization to start a Windows Service (I don't understand why "Power User" rights are not enough to do the same thing) Although I'm able to start a service using windows 2000 server...
8
3434
by: Nils Magnus Englund | last post by:
Hello, I am having trouble using Integrated Windows Authentication between our intranet server and our database server, both of which are on our local domain. Windows authentication works for our intranet server - my domain user "DOM\nme" is correctly authenticated and authorized to view the ASP.NET page on our intranet. The ASP.NET application uses impersonation (<identity impersonate="true"> in Web.config).
11
1829
by: Eric | last post by:
Hello, I have a web app that uploads files to a file server (different box than the web server). The application uses NT integrated authentication, but no users should have permissions to the file server. How can I use a fixed domain account to upload the files to the file server while still preserving the users' Windows integrated authentication on the web server?
8
16528
by: Keith H | last post by:
I'm looking for a way to force the user to re-authenticate with their Windows username/password/domain after clicking the submit button on an ASP.NET page. This is for an internal application. Does anyone know if/how this can be done?
7
3029
by: Alice Wong | last post by:
I am setting up my Web ASP.net application to connect to Sql server using windows authentication. I set up IIS to have integrated windows authenication and sql to allow Windows authentication. And I trun annonymous login. I use this connection to connect. server={0};database={1};Integrated Security=SSPI where {0} servname and {1} database name
0
2043
by: choukse | last post by:
Hi All, I am trying to bind to ADAM instance with a windows user through JNDI and it keeps failing. My ADAM and AD is running on same Windows 2k3 server. But, through LDP I am able to bind with the same windows user successfully and browse through the entire tree successfully. The error is as below
1
3570
by: =?Utf-8?B?c3VidGlsZQ==?= | last post by:
Hi :-) I'm having some trouble with LDAP and Active Directory on Win2k3 I use Windows Authentication and the code System.Threading.Thread.CurrentPrincipal.Identity.Name gives me the correct credentials when logged in. When I create user in AD i get an error. I have 4 scenarioes - one work and one don't. I'm very confused:
0
8983
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9236
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8235
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3298
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2774
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.