all groups > iis security > october 2003 >
You're in the

iis security

group:

IIS 6, ASP.NET, Web Request, impersonation and 401



IIS 6, ASP.NET, Web Request, impersonation and 401 Seb
10/28/2003 11:12:19 AM
iis security: Hi,

I have an ASP.NET app that sends HTTP WebRequests to an
exchange server that requires NTLM authentication. To do
so, the ASP.NET app is configured to impersonate the
current user. Everything works fine, except on our test
Win 2003 machine, where the web requests fail with a 401
answer form the exchange machine !

Here's the code that I use :

WebRequest req = ... ;
req.Credentials = CredentialCache.DefaultCredentials;
req.GetResponse();
....
<identity impersonate ="true"/> in the web.config

I did not touch ma IIS 6 config : the app runs in the
default app pool (NETWORK SERVICE identity)

By tracing the WindowsIdentity.GetCurrent at various
stages, I can tell that the impersonation was successful.
I tried to give all applicable privileges to the NETWORK
SERVICE identity, rebooted, without any success.

Thanks for any hints !

Sebastien
MCP

Re: IIS 6, ASP.NET, Web Request, impersonation and 401 Ken Schaefer
10/29/2003 10:35:51 PM
How are your users authenticating to the IIS6 server? If you are using
Integrated Authentication, then the IIS6 server doesn't have a security
token that can be then used to authenticate to the Exchange server (unless
you enable delegation).

Does everything start working if you use Basic instead? If so, then that's
your problem.

Cheers
Ken

[quoted text, click to view]
: Hi,
:
: I have an ASP.NET app that sends HTTP WebRequests to an
: exchange server that requires NTLM authentication. To do
: so, the ASP.NET app is configured to impersonate the
: current user. Everything works fine, except on our test
: Win 2003 machine, where the web requests fail with a 401
: answer form the exchange machine !
:
: Here's the code that I use :
:
: WebRequest req = ... ;
: req.Credentials = CredentialCache.DefaultCredentials;
: req.GetResponse();
: ....
: <identity impersonate ="true"/> in the web.config
:
: I did not touch ma IIS 6 config : the app runs in the
: default app pool (NETWORK SERVICE identity)
:
: By tracing the WindowsIdentity.GetCurrent at various
: stages, I can tell that the impersonation was successful.
: I tried to give all applicable privileges to the NETWORK
: SERVICE identity, rebooted, without any success.
:
: Thanks for any hints !
:
: Sebastien
: MCP

AddThis Social Bookmark Button