Webclient w/ Proxy

Discussion in 'ASP .Net Web Services' started by Steven J. Reed, Apr 21, 2005.

  1. I have a WebClient.OpenRead that is timing out on some client machines. I
    believe the problem may be Proxy settings on the client machine.

    How do I set proxy settings on a WebClient.OpenRead method?
    Steven J. Reed, Apr 21, 2005
    #1
    1. Advertising

  2. Hi Steven,

    Someone else may be able to help more with this, but it looks like you first
    need to create a WebProxy object and use the GlobalProxySelection Class

    How To Use WebClient Class To Make HTTP Requests

    http://support.microsoft.com/default.aspx?scid=kb;en-us;328820#XSLTH3129121122120121120120


    http://msdn.microsoft.com/library/d...ref/html/frlrfsystemnetwebproxyclasstopic.asp


    private bool SetProxy(string ProxyName)
    {
    //Set the proxy
    proxyObject = new WebProxy(ProxyName, true); // the true is to bypass
    local address
    // You can get the nondynamic proxy settings from Internet Explorer 5.5.
    // by using the line below. This is what we use by default if you don't
    set anything.
    //WebProxy proxyObject = WebProxy.GetDefaultProxy();
    // set the Credentials to the user's system credentials
    // This will handle NTLM authentication.
    // We will error trap for basic and then reqeust the username a password
    proxyObject.Credentials = CredentialCache.DefaultCredentials;
    GlobalProxySelection.Select = proxyObject;
    return true;
    }


    "Steven J. Reed" <> wrote in message
    news:...
    >I have a WebClient.OpenRead that is timing out on some client machines. I
    > believe the problem may be Proxy settings on the client machine.
    >
    > How do I set proxy settings on a WebClient.OpenRead method?
    >
    >
    Ken Cox [Microsoft MVP], Apr 21, 2005
    #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. vidy5300
    Replies:
    0
    Views:
    864
    vidy5300
    Jun 7, 2004
  2. Replies:
    0
    Views:
    1,642
  3. Karsten Wutzke
    Replies:
    1
    Views:
    876
    Steven Simpson
    Aug 20, 2007
  4. Klein Stéphane
    Replies:
    3
    Views:
    593
    Steve Holden
    Dec 20, 2009
  5. 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
Loading...

Share This Page