string str =PageContent.GetPageContent("http://www.hi.baidu.com/baixiaoxu");
//Request.UrlReferrer.ToString();
Response.ContentType = "text/html";
//Response.ContentType = "application/octet-stream";
//Response.ContentType = "application/save";
Response.ContentEncoding = System.Text.Encoding.Default; //添加该句调整编码格式。
Response.AddHeader("Content-Disposition", "attachment;fileName=data.html");
Response.Write(str);
Response.End();
public static string GetPageContent(string url)
{
WebClient client = new WebClient();
client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.Encoding = System.Text.Encoding.Default; //添加该句调整编码格式。
return client.DownloadString(url);
}