public void MakeHtml(){try{//动态页面网址string strUrl = "/product/Detail/Default.aspx?ContentID=123";//要存放静态网页的路径string filePath = "/product/";//物理完整路径string toFileFullPath = HttpContext.Current.Server.MapPath(filePath);//检查是否有该路径没有就创建if (!System.IO.Directory.Exists(toFileFullPath)){System.IO.Directory.CreateDirectory(toFileFullPath);}filePath = filePath + "index.html";if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(filePath))){File.Delete(System.Web.HttpContext.Current.Server.MapPath(filePath));}//创建请求//如果访问的地址是带证书的https,需要加上这句话,证书认证ServicePointManager.SecurityProtocol = (SecurityProtocolType)192 | (SecurityProtocolType)768 | (SecurityProtocolType)3072;//ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;HttpWebRequest Dd_gUrl = (HttpWebRequest)WebRequest.Create(strUrl);Dd_gUrl.UseDefaultCredentials = false;HttpWebResponse WebRe = (HttpWebResponse)Dd_gUrl.GetResponse();Stream strhtml = WebRe.GetResponseStream();StreamReader stRCmcnHtml = new StreamReader(strhtml, Encoding.GetEncoding("utf-8"));StreamWriter Sw = new StreamWriter(System.Web.HttpContext.Current.Server.MapPath(filePath), true, Encoding.GetEncoding("utf-8")); ;Sw.Write("<meta charset='utf-8'/>" + stRCmcnHtml.ReadToEnd());//<meta charset="utf-8"/>百度收录不乱码Sw.Flush();Sw.Close();strhtml.Close();WebRe.Close();stRCmcnHtml.Close();//return true;}catch (Exception ex){throw ex;}}