Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
98 lines (85 sloc) 5.41 KB
title ms.date helpviewer_keywords ms.assetid
Configuring Internet Applications
03/30/2017
downloading Internet resources, default proxy
sending data, default proxy
receiving data, default proxy
downloading Internet resources, configuring Internet applications
protocol-specific modules
custom authentication modules
receiving data, configuring Internet applications
configuration settings [.NET Framework], Internet applications
requesting data from Internet, configuring Internet applications
requesting data from Internet, default proxy
response to Internet request, default proxy
Internet, configuring Internet applications
response to Internet request, configuring Internet applications
default proxy
network resources, default proxy
sending data, configuring Internet applications
network resources, configuring Internet applications
Internet, default proxy
bb707c72-eed2-4a82-8800-c9e68df2fd4f

Configuring Internet Applications

The <system.Net> Element (Network Settings) configuration element contains network configuration information for applications. Using the <system.Net> Element (Network Settings) element, you can set proxy servers, set connection management parameters, and include custom authentication and request modules in your application.

The <defaultProxy> Element (Network Settings) element defines the proxy server returned by the GlobalProxySelection class. Any xref:System.Net.HttpWebRequest that does not have its own xref:System.Net.HttpWebRequest.Proxy%2A property set to a specific value uses the default proxy. In addition to setting the proxy address, you can create a list of server addresses that will not use the proxy, and you can indicate that the proxy should not be used for local addresses.

It is important to note that the Microsoft Internet Explorer settings are combined with the configuration settings, with the latter taking precedence.

The following example sets the default proxy server address to http://proxyserver, indicates that the proxy should not be used for local addresses, and specifies that all requests to servers located in the contoso.com domain should bypass the proxy.

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

Use the <connectionManagement> Element (Network Settings) element to configure the number of persistent connections that can be made to a specific server or to all other servers. The following example configures the application to use two persistent connections to the server www.contoso.com, four persistent connections to the server with the IP address 192.168.1.2, and one persistent connection to all other servers.

<configuration>  
    <system.net>  
        <connectionManagement>  
            <add address="http://www.contoso.com" maxconnection="2" />  
            <add address="192.168.1.2" maxconnection="4" />  
            <add address="*" maxconnection="1" />  
        </connectionManagement>  
    </system.net>  
</configuration>  

Custom authentication modules are configured with the <authenticationModules> Element (Network Settings) element. Custom authentication modules must implement the xref:System.Net.IAuthenticationModule interface.

The following example configures a custom authentication module.

<configuration>  
    <system.net>  
        <authenticationModules>  
            <add type="MyAuthModule, MyAuthModule.dll" />  
        </authenticationModules>  
    </system.net>  
</configuration>  

You can use the <webRequestModules> Element (Network Settings) element to configure your application to use custom protocol-specific modules to request information from Internet resources. The specified modules must implement the xref:System.Net.IWebRequestCreate interface. You can override the default HTTP, HTTPS, and file request modules by specifying your custom module in the configuration file, as in the following example.

<configuration>  
    <system.net>  
        <webRequestModules>  
            <add  
                prefix="HTTP"  
                type = "MyHttpRequest.dll, MyHttpRequestCreator"  
            />  
        </webRequestModules>  
    </system.net>  
</configuration>  

See also

You can’t perform that action at this time.