public static string HttpConnection(string strUrl)
{
string strResponse = "";
try
{
System.Net.HttpWebRequest webRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strUrl);
System.Net.HttpWebResponse webResponse = (System.Net.HttpWebResponse)webRequest.GetResponse();
System.Text.Encoding encode = System.Text.Encoding.GetEncoding("big5");
System.IO.Stream stream = webResponse.GetResponseStream();
System.IO.StreamReader streamReader = new System.IO.StreamReader(stream, encode);
strResponse = streamReader.ReadToEnd();
//-----release the reader and stream resource-----
streamReader.Close();
stream.Close();
}
catch(Exception exp)
{
throw exp;
}
return strResponse;
}
Tuesday, July 12, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment