Sumit Ghosh
Sumit Ghosh

Reputation: 3280

Can Internet Explorer use a Socks proxy programmatically?

I want C# code to use Socks 5 proxies in Internet Explorer. I have code for http proxies but that code is not working for Socks proxies.

Anyone has such code? Please provide some pointers.

I'm basically doing IE automation in C#, and I need code to use socks proxies using IE.

Upvotes: 2

Views: 3274

Answers (2)

user156676
user156676

Reputation:

What keeps you from setting

HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\

  • "ProxyEnable" to 1 (enable usage of proxy)
  • "AutoConfigURL" to a *.pac-file (can point to a file on localhost or distantserver)

?

Has the advantage that you can distribute one configuration-file which is easier to update than a binary when changes come up. *.pac files are quite simple:

function FindProxyForURL(url,host) {return"SOCKS my.socksproxy.net:<proxyport>"}

Besides: There is an "official" way: Setting IE-Settings through the Group Policies-API, everything documented on the MSDN. Lets you configure a proxy for every protocol but is not as simple as my first suggestion.

Upvotes: 1

Lex Li
Lex Li

Reputation: 63173

IE uses WinINet so if you change WinINet Proxy settings in registry I think it will affect IE and other applications using WinINet.

http://msdn.microsoft.com/en-us/library/ms905660.aspx

Under "Proxy settings" section, it mentioned that this key can be manipulated by WinINet functions. I think it is possible to use PInvoke in C# to call them.

Upvotes: 1

Related Questions