Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've been trying to make a proxy web browser in a c# application so far I have only managed to do this by changing the system registry to use a proxy, this is not the way I want to do it as that effects all browsers on the PC i want it to be within the application. I have tried this but it is failing to work:

C#
string proxyip = "200.54.246.14";
int proxyport = 8080;
System.Net.WebRequest.DefaultWebProxy = new WebProxy(proxyip, proxyport);

      webBrowser1.Navigate("http://www.whatismyipaddress.com/");
      webBrowser1.Refresh();


This does not work the whatismyipaddress website will return my actual ip, it works when i use this method:
C#
RegistryKey registry =    Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings", true);
registry.SetValue("ProxyEnable", 1);
registry.SetValue("ProxyServer", proxyip + ":" + proxyport.toString());

This method changes the proxy settings for the whole pc which is not what I want to do...

Any Suggestions?

Thanks
Posted

1 solution

Unfortunately, there isn't a straightforward solution. I've seen samples that rely on the overriding the Navigate method which works when you directly load the page, but fails when the user clicks a hyperlink in the returned document. Fortunately, there's a thorough working solution here[^].
 
Share this answer
 
Comments
BenJBaker╣ 30-Jan-14 4:55am    
Cheers, Great article gave me all the answers!
Pete O'Hanlon 30-Jan-14 5:23am    
I'm glad it helped.

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