David Crowell :: Occasional Thoughts

Some Dumb Tech Guy

  Home :: Contact :: Syndication  :: Login
  27 Posts :: 0 Articles :: 53 Comments

Archives

Post Categories

About Me

Archived Software

Thursday, May 01, 2008 #

I had a simple piece of code to grab an RSS feed from another site, and display it formatted the way I wanted.  I used caching, and it worked well on my develepment server.

When deploying to the client's server, it no longer worked.  I did some digging and found out that I'd have to use a proxy.  No big deal, just a few lines of code.  I really didn't like have to add code, and have a setting to disable it, or use a different proxy, or whatever.

Then I discovered, I didn't need to change the code.  Everything in the System.Net namespace can be configured to use a proxy in the web.config file.  I just added these few lines:

       <system.net>
              <defaultProxy>
                     <proxy
                           usesystemdefault="False"
                           proxyaddress="http://theproxy"
                           bypassonlocal="True"
                     />
              </defaultProxy>
       </system.net>