我是机器是局域网里的一台机器,通过局域网里的另一台代理服务器上网.
现在做了一个程序用到了axWebBrowser控制访问网页,由于使用代理上网,axWebBrowser无法连接网络.大家有什么办法,能让axWebBrowser控件配置成跟IE一样的网络连接配置.或者在程序里面直接指定代理服务器和端口号. 望高手指教.
现在做了一个程序用到了axWebBrowser控制访问网页,由于使用代理上网,axWebBrowser无法连接网络.大家有什么办法,能让axWebBrowser控件配置成跟IE一样的网络连接配置.或者在程序里面直接指定代理服务器和端口号. 望高手指教.
我测试过了,不跟IE配置一致.
SetLastError=true,
CharSet=CharSet.Auto,
EntryPoint="InternetSetOption",
CallingConvention=CallingConvention.StdCall)]
public static extern bool InternetSetOption
(
int hInternet,
int dmOption,
IntPtr lpBuffer,
int dwBufferLength
);public static void SetProxy()
{
//打开注册表
RegistryKey regKey = Registry.CurrentUser;
string SubKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
RegistryKey optionKey = regKey.OpenSubKey(SubKeyPath,true);
//更改健值,设置代理,
optionKey.SetValue("ProxyEnable",1);
optionKey.SetValue("ProxyServer","192.168.1.85:80"); //激活代理设置
InternetSetOption(0,39,IntPtr.Zero,0);
InternetSetOption(0,37,IntPtr.Zero,0);
}