C# webBrowser 通过代理访问网页
2016-01-20 14:24
543 查看
![](http://pic002.cnblogs.com/img/xvipservice/201009/2010090917060566.gif)
改变webBrowser1的代理
代码 #region 改变代理 [DllImport("wininet.dll", SetLastError = true)] private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr lpBuffer, int lpdwBufferLength); public void RefreshIESettings(string strProxy) { const int INTERNET_OPTION_PROXY = 38; const int INTERNET_OPEN_TYPE_PROXY = 3; Struct_INTERNET_PROXY_INFO struct_IPI; // Filling in structure struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY; struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy); struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local"); // Allocating memory IntPtr intptrStruct = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI)); // Converting structure to IntPtr Marshal.StructureToPtr(struct_IPI, intptrStruct, true); bool iReturn = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, Marshal.SizeOf(struct_IPI)); } #endregion
读取代理列表
c盘放了个代理的文件列表
![](http://pic002.cnblogs.com/img/xvipservice/201009/2010090917082232.jpg)
更改代理,访问网站
![](http://pic002.cnblogs.com/img/xvipservice/201009/2010090917090379.jpg)
免费代理的列表
211.144.219.66:80
222.74.34.190:808
121.8.171.40:3128
116.228.108.58:808
202.43.180.146:3128
58.215.78.157:808
61.134.27.214:8080
221.12.147.80:808
60.216.101.31:8080
123.139.158.189:3128
大家谁完善了发个给我用用哈
demo下载
相关文章推荐
- Hex文件解读
- C#-gridview中选择一行时取得该行的第一列字段
- C#综合揭秘——Entity Framework 并发处理详解
- c# VS2008中如何修改winfrom控件的可访问性
- C#中父窗口和子窗口之间控件互操作实例
- C# 操作 Excel 要点
- C# 简体繁体转换
- C#实现动态改ip
- C# 自定义控件制作和使用实例(winform)
- C# 环境
- C# 简介
- c# socket套接字
- [Winform][C#]获取系统颜色预定义颜色和现有字体集
- (转)C#正则表达式Regex类的用法
- C#-如何让TABLE中的TEXTBOX充满单元格
- C#中静态变量和 静态方法的作用
- [C#][控件]WebBrowser 使用范例
- sublime Text2编译C#(windows平台)
- 在c#中把字符串转为变量名并获取变量值的小例子(转)
- 【转】 C# 小技巧之获取变量名称