Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From .NET 2.0 you shouldn't need to do this. If you do not explicitly set the Proxy property on a web request it uses the value of the static WebRequest.DefaultWebProxy. If you wanted to change the proxy being used by all subsequent WebRequests, you can set this static DefaultWebProxy property.</p> <p>The default behaviour of WebRequest.DefaultWebProxy is to use the same underlying settings as used by Internet Explorer.</p> <p>If you wanted to use <strong>different proxy settings</strong> to the current user then you would need to code </p> <pre><code>WebRequest webRequest = WebRequest.Create("http://stackoverflow.com/"); webRequest.Proxy = new WebProxy("http://proxyserver:80/",true); </code></pre> <p>or</p> <pre><code>WebRequest.DefaultWebProxy = new WebProxy("http://proxyserver:80/",true); </code></pre> <p>You should also remember the object model for proxies includes the concept that the proxy can be different depending on the destination hostname. This can make things a bit confusing when debugging and checking the property of webRequest.Proxy. Call </p> <p><code>webRequest.Proxy.GetProxy(new Uri("http://google.com.au"))</code> to see the actual details of the proxy server that would be used.</p> <p>There seems to be some debate about whether you can set <code>webRequest.Proxy</code> or <code>WebRequest.DefaultWebProxy = null</code> to prevent the use of any proxy. This seems to work OK for me but you could set it to <code>new DefaultProxy()</code> with no parameters to get the required behaviour. Another thing to check is that if a <a href="http://msdn.microsoft.com/en-us/library/sa91de1e.aspx" rel="noreferrer">proxy element</a> exists in your applications config file, the .NET Framework will <strong>NOT</strong> use the proxy settings in Internet Explorer.</p> <p>The MSDN Magazine article <a href="http://msdn.microsoft.com/en-gb/magazine/cc300743.aspx" rel="noreferrer">Take the Burden Off Users with Automatic Configuration in .NET</a> gives further details of what is happening under the hood.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload