您的位置:首页 > Web前端 > HTML

.net读取输出项目中html文件

2010-06-24 13:18 253 查看
using System.Net;
using System.Text;
using System.IO;

protected void Page_Load(object sender, EventArgs e)
{
Encoding code = Encoding.GetEncoding("gb2312");
// 读取模板文件
string temp = HttpContext.Current.Server.MapPath("/CSInterface/html/games.htm");
StreamReader sr = null;
string str = string.Empty;
try
{
sr = new StreamReader(temp, code);
str = sr.ReadToEnd(); // 读取文件
}
catch (Exception exp)
{
str = "error";
sr.Close();
}
Response.Write(str);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐