Click here to Skip to main content
15,880,364 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to navigate to e specified Website or web page with the WebBrowser-Control in Windows Forms. But how to connect through a proxy server ? How to set the proxy server user name,password and port? etc

Was looking for the following as well and found it on the following site.
About half way down.

Set Proxy

You need to import unmanaged code it seems, but looks like it will do the trick.

Hope this helps.
Share this answer
Shabeer Ibrahim 22-Sep-10 1:33am    
Thank You Bardy85

I have already referred that site.Not helpful for me.
Bardy85 22-Sep-10 2:17am    
Did you implement the suggested solution in the comments section? I'm also need to implement a proxy in one of my projects but havn't had time to work on it, and thought that the above solution should work.
Shabeer Ibrahim 22-Sep-10 5:39am    
Hi Bardy85,

Yes i have implemented in my project but it asks user name and password while requesting web page.
Since the WebBrowser control is nothing more thanan instance of IE, you can get the proxy settings from the registry

You could do it this way (but since it manipulates the registry, it may require your app to have admin rights):

string key = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings";
string serverName = "";//your proxy server name;
string port = ""; //your proxy port;
string proxy = serverName + ":" + port;
RegistryKey RegKey = Registry.CurrentUser.OpenSubKey(key, true);
RegKey.SetValue("ProxyServer", proxy);
RegKey.SetValue("ProxyEnable", 1);

Of course, if you're not using IE, this will probably need to change.
Share this answer
Shabeer Ibrahim 22-Sep-10 1:31am    
Thanks John Simmons

In my case i don't want to set in registry.I try to apply proxy settings for my requests only.

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