Better Know A Framework: Getting the windows proxy settings

It’s a question I have seen a few times on the Microsoft forums: How do you get the default system proxy settings? Well, let me tell you the answer:

WebRequest.GetSystemWebProxy will return a proxy object with the default system proxy in it.

http://msdn.microsoft.com/en-us/library/system.net.webrequest.getsystemwebproxy.aspx

Using the DefaultWebProxy property on WebRequest you can get the proxy for the system unless it has been overridden in your app.config file. This is the best property to use so your app can be repointed to a different proxy. That property can also be set by your code to repoint your app

http://msdn.microsoft.com/en-us/library/system.net.webrequest.defaultwebproxy.aspx

So that’s the simplest way to get hold of the proxy settings for Windows apps.

Advertisements
This entry was posted in Better Know a Framework and tagged , , , . Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s