Domain property of NetworkCredential class

D

DT

I'm trying to provide flexible support of various HTTP proxy servers in my
web client app, and need to understand in what situations the various proxy
authentication properties are used...

Specifically, what should the Domain property of the NetworkCredential class
be set to when using WebProxy?

I'm testing against an Apache 2 proxy server, which is set to basic
authentication, with the name of its realm set to "Proxy Server".

When I don't set the Domain property of my NetworkCredential object, my
WebRequest.GetResponse works OK.

But when I set Domain to "Proxy Server" (which I expected to be required)...
I get HTTP 407.

So what exactly does the Domain specify? When is it used?

Code fragment below.

Thanks,

David Thom

Dim myWebRequest As WebRequest =
WebRequest.Create("http://www.microsoft.com")

Dim myWebProxy = New WebProxy

myWebProxy.Address = New Uri(http://10.0.2.6) ' the Apache proxy server

Dim myCredentials As New NetworkCredential

myCredentials.UserName = "user"

myCredentials.Password = "password"

' myCredentials.Domain = "Proxy Server" ' GetResponse works if I don't set
Domain property

myWebProxy.Credentials = myCredentials

myWebRequest.Proxy = myWebProxy

Dim myWebResponse As WebResponse = myWebRequest.GetResponse()
 

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