Forcing a .NET application proxy via web.config or app.config

Jun 23, 2013 dotnet csharp visualbasic

This lets you force a proxy for a .NET application including web sites, running under any user or service account. Very useful for proxying via Fiddler.

<system.net>
   <defaultProxy>
     <proxy
       autoDetect="false"
       bypassonlocal="false"
       proxyaddress="http://127.0.0.1:8888"
       usesystemdefault="false" />
   </defaultProxy>
</system.net>

Mocking and testing live responses

Instead of doing this, I highly recommend using a mockable proxy such as MockServer or running it in memory using an OWIN based hosted mocking server like JustFakeIt and running tests in memory.