Asp.net生成htm静态页面实现代码 (3)
66 Encoding code = Encoding.GetEncoding("utf-8");
67 StreamReader sr = null;
68 StreamWriter sw = null;
69 string str = null;
70
71 //读取远程路径
72 WebRequest temp = WebRequest.Create(txtUrl.Text.Trim());
73 WebResponse myTemp = temp.GetResponse();
74 sr = new StreamReader(myTemp.GetResponseStream(), code);
75 //读取
76 try
77 ...{
78 sr = new StreamReader(myTemp.GetResponseStream(), code);
79 str = sr.ReadToEnd();
80
81 }
82 catch (Exception ex)
83 ...{
84 throw ex;
85 }
86 finally
87 ...{
88 sr.Close();
89 }
90 string fileName = DateTime.Now.ToString("yyyyMMddHHmmss") + ".htm";
91
92 //写入
93 try
94 ...{

[
1] [
2]
[3] [
4]
