Get one of the contents of a Remote Web page (downmoon original)
First, when the local direct access to the Internet:
Get the specified Remote Web page content #region get the specified remote Web page content
Copy Code code as follows:
/**////<summary>
Get the specified Remote Web page content
</summary>
<param name= "strURL" > The remote page address to look for </param>
<param name= "Timeout" > timeout length settings, generally set to 8000</param>
<param name= "Entertype" > Output line breaks, 0 not output, 1 output text box wrapping </param>
<param name= "Encodetype" > Coding mode </param>
<returns></returns>
You can also consider a static string
public string getrequeststring (string strurl,int timeout,int entertype,encoding encodetype)
... {
String strresult;
Try
... {
HttpWebRequest Myreq = (HttpWebRequest) httpwebrequest.create (strURL);
Myreq.timeout = Timeout;
HttpWebResponse Httpwresp = (HttpWebResponse) myreq.getresponse ();
Stream MyStream = Httpwresp.getresponsestream ();
StreamReader sr = new StreamReader (MyStream, Encodetype);
StringBuilder Strbuilder = new StringBuilder ();
while ( -1!= Sr. Peek ())
... {
Strbuilder.append (Sr. ReadLine ());
if (entertype==1)
... {
Strbuilder.append ("");
}
}
strresult = Strbuilder.tostring ();
}
catch (Exception err)
... {
strresult = "Request Error:" + Err. message;
}
return strresult;
}
#endregion
Second: Through the domain environment Agent online When this is not! The next article decomposition, hehe!