How to Make an Easy Proxy Switch
By Peter Bromberg
It is easy to programmatically turn your internet proxy settings on and off in the Registry. Just create a small Windows Form with two buttons.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
namespace ProxySwitch
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
}
private void button2_Click(object sender, EventArgs e)
{
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 0);
}
}
}
Compile the above in Release mode, and put a shortcut to the executable on the Desktop.
How to Make an Easy Proxy Switch (858 Views)