- 论坛徽章:
- 0
|
string strUrl = this.strURL+"?UserName="+this.urlUserName+"&Passwd="+this.urlPasswd+"&textfield="+this.urlStockCode;
//获取远程数据***********************************************************************************
System.Net.NetworkCredential myCred=null;
if(this.sProxyDomain=="")
myCred=new System.Net.NetworkCredential(this.sProxyUser,this.sProxyPwd);
else
myCred=new System.Net.NetworkCredential(this.sProxyUser,this.sProxyPwd,this.sProxyDomain);
System.Net.WebProxy proxyObject = new System.Net.WebProxy("
http://"+this.sProxyServer+":"+this.sProxyPort+"/",true,null,(System.Net.ICredentials)myCred
);
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(@strUrl);
req.Proxy = proxyObject;
HttpWebResponse HttpWResp = (HttpWebResponse)req.GetResponse();
//*************************************获取远程数据******************************************************
// WebClient client = new WebClient();
// Byte[] responseData =
// client.DownloadData(@"
http://szchinamobile.efo.hk/test6.asp?UserName="+this.urlUserName+"&Passwd="+this.urlPasswd+"&textfield="+this.urlStockCode
);
//
// string stockXML = System.Text.Encoding.Default.GetString(responseData).Replace("\r\n","");
// DataSet ds = new DataSet();
// System.Xml.XmlTextReader oXmlReader = new XmlTextReader(new System.IO.StringReader(stockXML));
// ds.ReadXml(oXmlReader);
DataSet ds = new DataSet();
ds.ReadXml(HttpWResp.GetResponseStream());
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/86783/showart_2032337.html |
|