401 error

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
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top