Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
- registry.SetValue("ProxyEnable", 1);
- registry.SetValue("ProxyServer", "127.0.0.1:8080");
- [DllImport("wininet.dll")]
- public static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int dwBufferLength);
- public const int INTERNET_OPTION_SETTINGS_CHANGED = 39;
- public const int INTERNET_OPTION_REFRESH = 37;
- bool settingsReturn, refreshReturn;
- RegKey.SetValue("ProxyServer", YOURPROXY);
- RegKey.SetValue("ProxyEnable", 1);
- // These lines implement the Interface in the beginning of program
- // They cause the OS to refresh the settings, causing IP to realy update
- settingsReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
- refreshReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
Add Comment
Please, Sign In to add comment