Bypassing proxy settings for a HttpWebRequest

Published on Tuesday, September 8, 2015

Recently I was debugging a simple application that requested a local URL through the WebRequest implementation in .NET but that wasn't connecting properly for some unknown reason.

I ended up with the conclusion that the Internet Explorer proxy settings prevented the application from connecting properly and sought a way to prevent these proxy settings from being applied to the web request.

The solution for this was to simply set the proxy settings to null and the request would then bypass the proxy settings and then connected properly.

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("");
request.Proxy = null; // Bypass the default (IE) proxy 
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
comments powered by Disqus