做这个方法的时候,主要想到是的生成静态页面。
-
-
-
-
- private void getContentToHtml(string theaspxURL,string theHtmlURL)
- {
- HttpWebRequest hwq = (HttpWebRequest)WebRequest.Create(theaspxURL);
- hwq.Method = "GET";
- hwq.ContentType = "application/x-www-form-urlencoded;charset=utf8";
- WebResponse hwr = (WebResponse)hwq.GetResponse();
- byte[] bytes = new byte[hwr.ContentLength];
- Stream stream = hwr.GetResponseStream();
-
-
- stream.Read(bytes, 0, Convert.ToInt32(hwr.ContentLength));
-
- string filePath = theHtmlURL;
- filePath = Server.MapPath(filePath);
- File.WriteAllBytes(filePath, bytes);
- }
原文地址:https://www.cnblogs.com/dingdingmao/p/3146593.html