I have an application that changes some registry values during installation.
I am changing ProxyEnable and ProxyServer in HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Internet Settings.
This works fine when installed as "Just Me" in the .NET installer, but I would like to set these values for all users on the computer (Everyone).
My application is a proxy server that will log all the URL requests it receives. This requires that the proxy server settings are configured in the Internet settings. I would like this to happen as part of the installation process, rather than having the administrator install it for all users.
I know that this can be done using Group Policy, but some machines that will use this application will have multiple users, not Group Policy (XP Home, etc.).
Is there a way to change the mentioned registry keys so that all user IEs set Prxy settings?
The code I use is:
private void EnableProxy(string proxy) {
using(RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true)) {
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", proxy);
}
settingsReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED,
IntPtr.Zero, 0);
refreshReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
}
private void DisableProxy() {
using(RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true)) {
registry.SetValue("ProxyEnable", 0);
registry.DeleteValue("ProxyServer", false);
}
settingsReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED,
IntPtr.Zero, 0);
refreshReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
}