Click here to Skip to main content
15,889,096 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I'm trying to change IE proxies programmatically. I've tried in many ways but no matter what I try it will not change it more then once, unless my program is restarted? Anyone else experience this / have a fix?

Here is my code snippet
C#
RegistryKey registry = Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);  
    registry.SetValue("ProxyEnable", 1);
    registry.SetValue("ProxyServer", txtproxyaddr.Text);   
    registry.SetValue("MigrateProxy", 1);
    registry.SetValue("ProxyHttp1.1", 1);
    settingsReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
    refreshReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);


Thank you.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900