Professional Web Applications Themes

Webclient w/ Proxy - ASP.NET Web Services

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?...

  1. #1

    Default Webclient w/ Proxy

    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 Guest

  2. #2

    Default Re: Webclient w/ Proxy

    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

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


    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemnetwebproxyclasstopic.asp[/url]


    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" <StevenJReeddiscussions.microsoft.com> wrote in message
    news:BA000BF3-EBD9-44DF-9372-F1A6546F3B33microsoft.com...
    >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] Guest

Similar Threads

  1. WebClient Not posting to Client
    By Tom in forum ASP.NET Web Services
    Replies: 2
    Last Post: February 2nd, 04:33 PM
  2. webclient.downloadfile
    By jared in forum ASP.NET Security
    Replies: 1
    Last Post: November 21st, 08:29 AM
  3. DefaultCredentials and WebClient
    By Colin Bowern in forum ASP.NET Security
    Replies: 0
    Last Post: January 9th, 10:43 PM
  4. CookieContainer with WebClient
    By Martin Kuba in forum ASP.NET General
    Replies: 0
    Last Post: August 5th, 04:51 PM
  5. WebClient Problem
    By yysiow in forum ASP.NET General
    Replies: 1
    Last Post: July 10th, 06:07 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139