private void NewMethod()
{
string lcHtml = "";
HttpWebRequest loHttp;
//string ss = "http://" + HttpContext.Current.Request.Url.Host + ":" + HttpContext.Current.Request.Url.Port + this.ResolveUrl("~");
string ss = Request.Url.ToString();
loHttp = (HttpWebRequest)WebRequest.Create(ss);
loHttp.Timeout = 50000;
HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();
Encoding enc = Encoding.GetEncoding("utf-8");
StreamReader loResponseStream = new StreamReader(loWebResponse.GetResponseStream(), enc);
lcHtml = loResponseStream.ReadToEnd();
//写文件操作
if (File.Exists(Server.MapPath("HTMLPage.htm")))
{
FileStream file = new FileStream(Server.MapPath("HTMLPage.htm"),FileMode.Create);
file.Dispose();
//File.Delete(Server.MapPath("/frame/Index/shtml/html/mainAd.html"));
}
StreamWriter objWriter = new StreamWriter(Server.MapPath("HTMLPage.htm"), true, System.Text.Encoding.UTF8);
objWriter.WriteLine(lcHtml);
objWriter.Close();
Response.Redirect("HTMLPage.htm");
}