c# - why won't WebProxy BypassProxyOnLocal work for me? -


i'm trying http calls i'm making c# .net local address (localhost:3000) use proxy set (so can go through fiddler). using below webproxy approach works if point target url non-local address, need point local web-server have (at localhost:3000), , when request not going through proxy.

i have inlcuded "proxyobject.bypassproxyonlocal = false". should make work no? suggestions re how force request go through webproxy http calls targetting local address?

    webproxy proxyobject = new webproxy("http://localhost:8888/", false);     proxyobject.credentials = new networkcredential();      proxyobject.bypassproxyonlocal = false;     webrequest.defaultwebproxy = proxyobject;      var request = (httpwebrequest)webrequest.create(targeturi);      // included line double check     request.proxy = proxyobject; 

subsequent calls not go through proxy however, such when do:

 var res = (httpwebresponse)req.getresponse(); 

thanks

i around appending "dot" localhost, instead of accessing "localhost", try access "localhost." (notice dot @ end of hostname)

credit credit due: got unusual tip thread http://www.west-wind.com/weblog/posts/2009/jan/14/monitoring-http-output-with-fiddler-in-net-http-clients-and-wcf-proxies#596591

works fine!


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -