asp.net生成静态页面的一个方法
public void makeht(string url, string makedhtm)
{
HttpWebRequest request = null;
HttpWebResponse response = null;
Stream stream = null;
StreamReader reader = null;
request = (HttpWebRequest)WebRequest.Create(url.Trim());
response = (HttpWebResponse)request.GetResponse();
stream = response.GetResponseStream();
reader = new StreamReader(stream);
string result = reader.ReadToEnd();
reader.Close();
response.Close();
//string savePath = Server.MapPath("~/htm/" + makedhtm.Trim());
string savePath = Server.MapPath("~/" +makedhtm.Trim());
StreamWriter writer = new StreamWriter(savePath, false, Encoding.UTF8);
writer.Write(result);
writer.Close();
Label2.Text = makedhtm + "生成成功";
}