[C# Helper]
Index Books FAQ Contact About Rod
[Beginning Database Design Solutions, Second Edition]

[Beginning Software Engineering, Second Edition]

[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: See if Internet Explorer uses a proxy in C#

[See if Internet Explorer uses a proxy in C#]

This example determines whether the system has Internet Explorer configured to use a proxy.

Internet Explorer lets you specify proxy settings. In the Tools menu, select Internet Options. On the Connections tab, click the LAN Settings button.

[See if Internet Explorer uses a proxy in C#] The goal of this example is to figure out if the box indicated by the arrow in the picture on the right is checked.


The IsInternetProxyEnabled method shown in the following code returns true if the box is checked.

// Return True if the internet settings has ProxyEnable = true. private bool IsInternetProxyEnabled() { // See if Internet Explorer uses a proxy. RegistryKey key = Registry.CurrentUser.OpenSubKey( "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"); string[] keys = key.GetValueNames(); bool result = (int)key.GetValue("ProxyEnable", 0) != 0; key.Close(); return result; }

The method looks at the Registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings. If the value of ProxyEnable is not 0, then the box is checked and the method returns true.

The way this works changes with each release, presumably to make you think something is new and improved, so I don't know if this works with the latest browser Microsoft Edge. To get to its proxy settings:

  • Click the ellipsis (...) in the upper right
  • Select Settings
  • Scroll down and click View Advanced Settings
  • Open Proxy Settings
  • Click Open Proxy Settings

If you try it in Edge, please post your results in the comments below.

Download the example to experiment with it and to see additional details.

© 2009-2023 Rocky Mountain Computer Consulting, Inc. All rights reserved.