我想将处理 ASP 页面的结果保存为 html 文件。任何人都知道这是否可能?谢谢
问问题
1358 次
1 回答
1
这可以帮助您保存 ASP 页的输出
<script runat="server">
void Page_Load() {
String inputFile = MapPath("input-page.aspx");
String sDiskFile = "result.htm";
WebRequest webRequest = WebRequest.Create(inputFile);
WebResponse webResponse = webRequest.GetResponse();
Stream stream = webResponse.GetResponseStream();
StreamReader oReader = new StreamReader(stream, Encoding.ASCII);
StreamWriter oWriter = new StreamWriter(Server.MapPath(sDiskFile));
oWriter.Write(oReader.ReadToEnd());
oWriter.Close();
oReader.Close();
webResponse.Close();
// display confirmation that it worked
lblOutput.Text = inputFile;
aLink.Text = sDiskFile;
aLink.NavigateUrl = sDiskFile;
}
//-----------------------------------------
</script>
于 2012-11-19T12:01:46.027 回答