Proxy tutorial using c# webbrowser - help!

adonic

Newbie
Joined
Nov 13, 2009
Messages
13
Reaction score
1
hi hellow

I have list of proxy in the listbox and im trying to edit the registry

i was able to change the proxy in the registry but my webbrowser doesnt load the html page. T_T

*Note that the proxy im using is "alive" or should i say "its working"

Here is the code i use:

string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";

Random randomproxy = new Random();

string proxy = listBox2.Items[randomproxy.Next(0, listBox2.Items.Count)].ToString() ;

RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);
RegKey.SetValue("ProxyServer", proxy);
RegKey.SetValue("ProxyEnable", 1);

<hr/>

Can someone give me a simple project that uses proxy with web webbroser control...

Can someone give me the correct code in using proxy and i will see the result in the web browser
 
Hmmmmmmmm, I think you would be better off learning about the HttpWebRequest class :)

Use that for communication, and load the results into the webbrowser control if you need to.
 
Make sure you are passing the port # to the registery. Run your code and then open up IE's options and go to the proxy settings and see if the proxy info is what you wanted.

With "string proxy = listBox2.Items[randomproxy.Next(0, listBox2.Items.Count)].ToString() ;" you will get an error if it picks the last proxy. Remember that Count starts at 1 but items in the listBox start at 0. You just need to -1 for the count like :string proxy = listBox2.Items[randomproxy.Next(0, listBox2.Items.Count - 1)].ToString() ;
 
Back
Top