Default proxy settings in .Net configuration files

In environments that provide access to the internet through a proxy .Net Assemblies might fail to access the services located on the internet. An easy way to overcome this is to configure the defaultProxy element  in the .Net configuration file for the assembly.

<configuration>
  <system.net>
    <defaultProxy>
      <proxy usesystemdefault="true"
        proxyaddress="http://192.168.1.10:3128"
        bypassonlocal="true" />
      <bypasslist>
        <add address="[a-z]+\.contoso\.com" />
      </bypasslist>
    </defaultProxy>
  </system.net>
</configuration>

The defaultProxy configuration element accepts an address, credentials an optional bypass list.

The configuration can also be inherited by .Net assemblies providing a COM interface if the defaultProxy is configured in the caller’s configuration file.

Advertisements

About Oliver Dehne
Father of two little boys, good boys. Sometimes I like coding, trying to be a good developer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: