后台生成HTML时显示中文件方法。解决IE8显示界面的兼容

来源:互联网 发布:淘宝网肚皮舞服装 编辑:程序博客网 时间:2024/04/27 22:04

1、 注意:要添加 “using System.IO;”FileStream和StreamWriter都是IO的子类

FileStream fs = new FileStream(Server.MapPath(path + "/" + newid + ".html"), FileMode.Create, FileAccess.Write);
 StreamWriter sw = new StreamWriter(fs, Encoding.UTF8);
 sw.Write(template);
 sw.Close();
 fs.Close();

 

 

2、解决IE8显示界面的兼容

<head id="Head1" runat="server">
    <title>添加信息</title>
    <meta http-equiv="x-ua-compatible" content="ie=7" />

</head>

原创粉丝点击