Use ASP.net to implement all links in the page _dos/bat
Source: Internet
Author: User
private void Page_Load (object sender, System.eventargse)
{
Place user code here to initialize page
string URL =http://www.jb51.net;
System.Net.HttpWebRequesthttpReq;
System.Net.HttpWebResponsehttpRes;
System.urihttpurl = new Uri (URL);
Httpreq = (System.Net.HttpWebRequest) System.Net.WebRequest.Create (Httpurl);
Httpreq.method= "Get";
Httpres= (System.Net.HttpWebResponse) httpreq.getresponse ();
Httpreq.keepalive= false;
System.IO.StreamReadersReader = NewSystem.IO.StreamReader (Httpres.getresponsestream (), System.Text.Encoding.GetEncoding ("GB2312"));
Stringres = Sreader.readtoend ();
The following is the use of regular expressions to filter the obtained text stream
Stringstrregex = @ "<a.+?a>";
SYSTEM.TEXT.REGULAREXPRESSIONS.REGEXR;
System.Text.RegularExpressions.MatchCollectionm;
R = NewSystem.Text.RegularExpressions.Regex (strregex,system.text.regularexpressions.regexoptions.ignorecase);
M =r.matches (RES);
Response.Write ("This page has a total of" +m.count + "A super Connection <br/>");
for (inti = 0; i < M.count; i++)
{
Response.Write (M[i]. Value+ "<br/>");
}
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service