//=(@"Software\Microsoft\Windows\CurrentVersion\Settings",true);//("ProxyEnable",1);//("ProxyServer",":808");();使用WebProxy类,;WebProxyproxyObject=newWebProxy("***IP和端口(例如:http://proxyserver:80/)",true);WebRequestreq=("t;);//=proxyObject;//设置代理publicstringCallWebPage(stringurl,stringpostDataStr,EncodingsendEncod,EncodingreadEncod){stringrStr="";.WebRequestreq=null;.WebResponseresp=null;=null;=null;try{//创建连接req=.(url);//设置访问方式和发送的请求数据的内容类型if((postDataStr)){="application/x-ded";="GET";}else{="application/x-ded";="POST";if(sendEncod==null){sendEncod=;}byte[]bytes=(postDataStr);=;os=();(bytes,0,);();}//读取返回结果resp=();if(readEncod==null){readEncod=;}sr=((),readEncod);rStr=();}catch(Exceptionex1){//(":"+);}finally{try{//关闭资源if(os!=null){();();}if(sr!=null){();();}
C 设置IE代理和使用代理访问网页 来自淘豆网www.taodocs.com转载请标明出处.