1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Proxy tutorial using c# webbrowser - help!

Discussion in 'C, C++, C#' started by adonic, Mar 29, 2010.

  1. adonic

    adonic Newbie

    Joined:
    Nov 13, 2009
    Messages:
    13
    Likes Received:
    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
     
  2. crashed

    crashed Jr. VIP Jr. VIP Premium Member

    Joined:
    Aug 13, 2008
    Messages:
    958
    Likes Received:
    1,198
    Occupation:
    Guru-slayer
    Location:
    Behind the VPN...
    Home Page:
    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.
     
  3. ShiftySituation

    ShiftySituation Power Member

    Joined:
    Apr 15, 2010
    Messages:
    621
    Likes Received:
    314
    Occupation:
    Having fun
    Location:
    Jacksonville, FL
    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() ;