您的位置:首页 > 编程语言 > ASP

aspx页面生成html

2011-12-07 00:02 302 查看
ToHtml.aspx

protected void Page_Load(object sender, EventArgs e)
{
//使用示例:
//ToHtml.aspx?src=default.aspx 生成default.html
//ToHtml.aspx?src=default.aspx?tag=index.html 生成index.html
string source = Request.Params["src"];
string target = Request.Params["tag"];
if (target == null || target.Trim().Length == 0)
{
target = source.Replace(".aspx", ".html");
}
StreamWriter sw = new StreamWriter(Server.MapPath(target), false, System.Text.Encoding.GetEncoding("utf-8"));
Server.Execute(source, sw);
sw.Close();
//Response.Redirect(target);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: