The webservice, the httprequest and the proxy

Discussion in 'ASP .Net Web Services' started by Andrew Brook, May 18, 2007.

  1. Andrew Brook

    Andrew Brook Guest

    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
    Andrew Brook, May 18, 2007
    #1
    1. Advertising

  2. Andrew Brook

    Andrew Brook Guest

    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.

    "Andrew Brook" <> wrote in message
    news:%...
    > 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
    >
    Andrew Brook, May 18, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick Strahl [MVP]

    Client side HttpRequest or Call WebService.

    Rick Strahl [MVP], Oct 29, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    1,136
    Rajesh.V
    Oct 29, 2003
  2. Karsten Wutzke
    Replies:
    1
    Views:
    876
    Steven Simpson
    Aug 20, 2007
  3. Alejandro Molina

    Proxy and non Proxy configurations

    Alejandro Molina, Jul 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    148
    Alejandro Molina
    Jul 15, 2004
  4. Greg
    Replies:
    4
    Views:
    298
    Steven Simpson
    Aug 16, 2012
  5. Knute Johnson
    Replies:
    0
    Views:
    198
    Knute Johnson
    Jul 29, 2012
Loading...

Share This Page