如何将ASP.NET页面保存为HTML文件
来源:互联网 发布:无人机app源码 编辑:程序博客网 时间:2024/05/16 07:21
//用于保存文件的流
System.IO.FileStream stream = null;
//用于保存写入队对象
System.IO.TextWriter writer = null;
string queryString = "";
System.Uri uri = new Uri(@"http://localhost:1138/Base64/imagehadlling/GridView_DropDownList.aspx");
string targetFilePath = Server.MapPath("");
try
...{
//创建Http请求
HttpRequest request = new HttpRequest(uri.AbsolutePath, uri.AbsoluteUri, queryString);
//创建保存的文件流
stream = new System.IO.FileStream(@"F:defaut.html", System.IO.FileMode.Create);
//创建文件写入对象
writer = new System.IO.StreamWriter(stream, System.Text.UTF8Encoding.UTF8);
//创建Http反馈
HttpResponse Response = new HttpResponse(writer);
//创建Http上下文
HttpContext context = new HttpContext(request, Response);
//添加Session
context.Items.Add("AspSession", HttpContext.Current.Session);
//创建页面分析器
System.Web.IHttpHandler handler = System.Web.UI.PageParser.GetCompiledPageInstance(uri.AbsolutePath,
HttpContext.Current.Server.MapPath(uri.AbsolutePath), context);
//执行请求
handler.ProcessRequest(context);
//写入信息
writer.Flush();
//关闭
writer.Close();
}
catch (System.Exception ex)
...{
Label1.Text = ex.Message;
}
}
System.IO.FileStream stream = null;
//用于保存写入队对象
System.IO.TextWriter writer = null;
string queryString = "";
System.Uri uri = new Uri(@"http://localhost:1138/Base64/imagehadlling/GridView_DropDownList.aspx");
string targetFilePath = Server.MapPath("");
try
...{
//创建Http请求
HttpRequest request = new HttpRequest(uri.AbsolutePath, uri.AbsoluteUri, queryString);
//创建保存的文件流
stream = new System.IO.FileStream(@"F:defaut.html", System.IO.FileMode.Create);
//创建文件写入对象
writer = new System.IO.StreamWriter(stream, System.Text.UTF8Encoding.UTF8);
//创建Http反馈
HttpResponse Response = new HttpResponse(writer);
//创建Http上下文
HttpContext context = new HttpContext(request, Response);
//添加Session
context.Items.Add("AspSession", HttpContext.Current.Session);
//创建页面分析器
System.Web.IHttpHandler handler = System.Web.UI.PageParser.GetCompiledPageInstance(uri.AbsolutePath,
HttpContext.Current.Server.MapPath(uri.AbsolutePath), context);
//执行请求
handler.ProcessRequest(context);
//写入信息
writer.Flush();
//关闭
writer.Close();
}
catch (System.Exception ex)
...{
Label1.Text = ex.Message;
}
}
- 如何将ASP.NET页面保存为HTML文件
- 将一个Asp页面保存为HTML文件
- 将Asp.net页面输出为HTML
- 将Asp.Net页面输出为HTML
- 将Asp.Net页面输出为HTML
- 将Asp.Net页面输出为HTML
- 将Asp.net页面输出为HTML
- 将Asp.net页面输出为HTML
- 将Asp.net页面输出为HTML
- 将Asp.Net页面输出为HTML
- asp.net将word转换为html保存
- asp.net将word转换为html保存
- asp.net将word转换为html保存
- asp.net将word转换为html保存
- 如何使用,ASP.Net,将Word,转换为,HTML文件,教程实例
- asp.net 将table保存为Excle
- 如何将html模板保存为图片
- 将html流保存为word文件
- 开放型MODBUS-TCP规范(英文版)
- 开发智能手机应用软件
- aspHtml2Ubb函数
- Hibernate 多层数据关联
- KMP重装后出现"无法创建图表生成器"的解决办法
- 如何将ASP.NET页面保存为HTML文件
- SQL Server sysobjects 表结构
- 人力资源调查:中国游戏公司研发力排名
- 程序的框架学习
- 生成试题基本算法和代码片段
- php代码优化及php相关问题总结
- 发动解放自己的运动
- 狗与狼的时间
- C#如何压缩与解压缩文件