I do not know how to do this in the defaultProxy section for web.config, but you can definitely do this from the code. Try the following:
// Get proxy server info from AppSettings section of Web.Config var proxyServerAddress = ConfigurationManager.AppSettings[ "proxyServerAddress" ]; var proxyServerPort = ConfigurationManager.AppSettings[ "proxyServerPort" ]; // Get proxy with default credentials WebProxy proxy =new WebProxy(proxyServerAddress, proxyServerPort); proxy.Credentials = System.Net.CredentialCache.DefaultCredentials();
Web.Config (configuration section):
<appSettings> <add key="proxyServerAddress" value="proxy.myhost.com" /> <add key="proxyServerPort" value="8080" /> </appSettings>
And then assign the proxy web client that you use in your web page.
EDIT:
If I did more homework, I would understand that your problem could be fixed with a single attribute: useDefaultCredentials = "true"
<system.net> <defaultProxy useDefaultCredentials="true"> <proxy usesystemdefault="False" proxyaddress="http://127.0.0.1:8888" bypassonlocal="True" /> </defaultProxy> </system.net>
Byron sommardahl
source share