<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Paulo Morgado : Internet</title><link>http://msmvps.com/blogs/paulomorgado/archive/tags/Internet/default.aspx</link><description>Tags: Internet</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Setting A Web Proxy Through Configuration In .NET Applications</title><link>http://msmvps.com/blogs/paulomorgado/archive/2009/01/12/setting-a-web-proxy-through-configuration-in-net-applications.aspx</link><pubDate>Mon, 12 Jan 2009 19:06:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1661210</guid><dc:creator>Paulo Morgado</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/paulomorgado/rsscomments.aspx?PostID=1661210</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/paulomorgado/commentapi.aspx?PostID=1661210</wfw:comment><comments>http://msmvps.com/blogs/paulomorgado/archive/2009/01/12/setting-a-web-proxy-through-configuration-in-net-applications.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;Specially in enterprise environments, proxy servers are used to access the Internet.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;In a &lt;a target="_blank" href="http://cli.gs/cligs/Microsoft-Windows" title="Microsoft Windows"&gt;Windows&lt;/a&gt; / &lt;a target="_blank" href="http://cli.gs/Internet-Explorer" title="Internet Explorer"&gt;Internet Explorer&lt;/a&gt; environments there is a proxy server configuration in Internet &lt;strong&gt;Properties&lt;/strong&gt; &amp;gt; &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;LAN settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Proxy server&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;Although these configurations are tightly connected to Internet Explorer, any well behaved Windows application should, at least, allow the user to choose to use them.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;In applications targeting the &lt;a target="_blank" href="http://cli.gs/cligs/Microsoft-NET" title="Microsoft .NET"&gt;.NET framework&lt;/a&gt;, these the proxy server can be set on a per call basis. Several networking classes have a Proxy property that receives a value implementing the &lt;a target="_blank" href="http://cli.gs/QNbUQ8" title="IWebProxy Interface"&gt;IWebProxy&lt;/a&gt; interface.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;In order for the Windows/ Internet Explorer configuration to be used, the application must be configured to use the default proxy settings.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;This configuration is done in the machine or application file in the &lt;a target="_blank" href="http://cli.gs/bDYvUy" title="proxy Element (Network Settings)"&gt;proxy&lt;/a&gt; element of the &lt;a target="_blank" href="http://cli.gs/AHTSq7" title="defaultProxy Element (Network Settings)"&gt;defaultProxy&lt;/a&gt; configuration section in the &lt;a target="_blank" href="http://cli.gs/sUASsa" title="system.net Element (Network Settings)"&gt;system.net&lt;/a&gt; section group:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;configuration&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;system.net&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;defaultProxy &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;enabled&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;proxy &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;usesystemdefault&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;True&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;defaultProxy&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;system.net&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;configuration&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can use this configuration also to set a specific proxy to be used by your application. In the following example, a proxy setting for using the &lt;a target="_blank" href="http://cli.gs/FiddlerTool" title="Fiddler - Web Debugging Proxy"&gt;Fiddler Tool&lt;/a&gt; is used:&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;configuration&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
  &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;system.net&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;defaultProxy &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;enabled&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;
      &amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;proxy &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;proxyaddress&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;http://ipv4.fiddler&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;defaultProxy&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
  &amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;system.net&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;configuration&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, this is a MachineToApplication setting and, for that reason, is not allowed in the user settings configuration file, when in a shared installation. In these type of installations, the default Windows / Internet Explorer settings should be used as a default. If a user needs or wants to specify proxy server settings, application specific proxy server settings must be used but, assigning the user defined proxy server configuration to the &lt;a target="_blank" href="http://cli.gs/d5LP0S" title="GlobalProxySelection.Select Property"&gt;GlobalProxySelection.Select&lt;/a&gt; property will allow its use for the entire application.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://paulomorgado.net/"&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1661210" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/paulomorgado/archive/tags/.NET/default.aspx">.NET</category><category domain="http://msmvps.com/blogs/paulomorgado/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://msmvps.com/blogs/paulomorgado/archive/tags/MSDN/default.aspx">MSDN</category><category domain="http://msmvps.com/blogs/paulomorgado/archive/tags/InternetExplorer/default.aspx">InternetExplorer</category><category domain="http://msmvps.com/blogs/paulomorgado/archive/tags/Windows/default.aspx">Windows</category><category domain="http://msmvps.com/blogs/paulomorgado/archive/tags/Internet/default.aspx">Internet</category></item></channel></rss>