protected string UrlPrefix(HttpRequest req)
{
string path = "http://"
+ req.Url.Host.ToString();
path += req.ApplicationPath != "/"
? req.ApplicationPath + "/"
: req.ApplicationPath;
return path;
}
读取动态生成静态页面
string http =this.UrlPrefix(HttpContext.Current.Request)+strPath+"/default.aspx";
WebRequest wr = WebRequest.Create(http);
WebResponse wrs = wr.GetResponse();
Stream stm = wrs.GetResponseStream();
StreamReader st = new StreamReader(stm, Encoding.Default);
StringBuilder sb = new StringBuilder();
sb.Append(st.ReadToEnd());
string Path=Server.MapPath("../../"+strPath+"/index.html");
StreamWriter sw = new StreamWriter(Path, false, Encoding.UTF8, 20480);
sw.Write(sb);
sw.Flush();
sw.Close();