首页 > 代码库 > 获取网页源码

获取网页源码


HttpWebRequest _WebRequest = (HttpWebRequest)WebRequest.Create(Request.QueryString["url"]);
_WebRequest.Method = "GET";
WebResponse _WebResponse = _WebRequest.GetResponse();
StreamReader _ResponseStream = new StreamReader(_WebResponse.GetResponseStream());
ViewBag._StrResponse = _ResponseStream.ReadToEnd();
_WebResponse.Close();
_ResponseStream.Close();
return View();

获取网页源码