401 error

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi,

We wrote a reverse proxy and use Windows Authentication in our websites. The
first time the user connects, an exception occurs (401 Unauthorized). The
code we use is the following:

Dim uri As Uri = New Uri(_remoteServer + OPEN_BRACKET +
context.Session.SessionID + CLOSE_BRACKET + url)
_request = CType(WebRequest.Create(uri), HttpWebRequest)
_request.PreAuthenticate = True
_request.Credentials = CredentialCache.DefaultCredentials
Dim response As HttpWebResponse =
DirectCast(_request.GetResponse(), HttpWebResponse) ' HERE THE
EXCEPTION OCCURS

Is there anything that we forgot to set? If not how can we handle the
exception and resend a request?

Thanks a lot.
Mike
 
you are using the default credentials, which are either:

the asp.net service account which does not have domain permissions, and
can not connect to the server.

you have impersonate on and are using nt security. in this case your
server does not have a primary token (1 hop rule). you will need to
switch to kerberos or basic authentication.

-- bruce (sqlwork.com)
 
Back
Top