10

I have internet connection via http proxy, and some of my web applications at localhost need to access internet. Where can i set up proxy settings for them?

Ilya Smagin
  • 5,992
  • 11
  • 40
  • 57

1 Answers1

36

All I needed was to set system.net in web.config

<system.net>
    <defaultProxy>
      <proxy
        proxyaddress="http://10.0.2.231:42"
        bypassonlocal="true"
      />
    </defaultProxy>
</system.net>

See: Element (Network Settings).

kenorb
  • 155,785
  • 88
  • 678
  • 743
Ilya Smagin
  • 5,992
  • 11
  • 40
  • 57
  • 1
    how about password and username for proxy? shouldn't we provide that? – Blue Clouds Mar 28 '18 at 16:30
  • 1
    @BlueClouds as far as I know, there is no possibility to configure username and password from the web.config. The only possibility will be to use attribute **useDefaultCredentials=true**, in order to pass host credentials to the proxy. – CesarB Aug 24 '18 at 13:16
  • @BlueClouds check this one https://stackoverflow.com/a/8180854/1837339 and you probably need add the credentials through credential manager too https://answers.microsoft.com/en-us/windows/forum/windows_10-networking/adding-credentials-to-windows-proxy-settings/d6fdab82-6163-4aad-8133-43f7706ceb9c – bigbearzhu May 14 '19 at 01:48