The webservice, the httprequest and the proxy


A

Andrew Brook

Hi everyone,

I'm confused at the moment by a proxy. Here's my scenario.

Using .NET 2.0, when I create a HttpWebRequest I do not need to set the
proxy property because by default it seems to use the same proxy that IE
uses, I do however need to set the credentials to use the default credential
because this does not happen automatically. When I do this, everything works
as planned because I recieve the expected response and not a 407. If i take
out the credentials assignment then I recieve my 407. I'm happy with this.
The only query I have here is is there any way to see the values of the
default proxy at this stage? The HttpWebRequest.Proxy property is of type
WebProxyWrapper and doesn't really expose any information that i can see and
feel happy with.

When it comes to adding a web reference to one of my own web services, if I
don't set the proxy property of the SoapHttpClientProtocol object then the
proxy is bypassed (opposite of the above behaviour) as no default value is
used. Also, say I now want to set the webservice client to use the default
proxy, the documentation suggests the way to do this is to just create a new
WebProxy and that will have the default settings, but when I do this, the
webservice works like it is still bypassing the proxy (i don't get a 407).
So it looks to me like in that instance, the new WebProxy does not contain
the proxy values at all.

Hopefully someone who knows more about the .NET framework and using proxies
will be able to help clarify my situation, I appreciated there is a lot of
rant here so please shout up for more info if required.

thanks,
Andrew
 
Ad

Advertisements

A

Andrew Brook

Thinking about this some more and writing a few test harnesses it looks like
I was probably getting a couple of things wrong (at least). My testing shows
that creating a new HttpWebRequest does have the default proxy settings,
however, in order to retrieve these proxy settings for use on my
SoapHttpClientProtocol instance I need to call WebRequest.DefaultWebProxy.
Things are starting to become a little clearer.
 

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