生成的html文件很乱,怎么办?
源:
de.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;//
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;//StringBuilder 类命名空间
using System.IO;//读取写入命名空间
public partial class Dhtml : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCreate_Click(object sender, EventArgs e)
{
string[] newContent = new string[5];//定义数组用来保存temphtml.html中的标记数目
StringBuilder strhtml = new StringBuilder();//实例化一个strhtml
try
{
//创建StreamReader对象 news为TempHtml.html所在的文件夹
using (StreamReader sr = new StreamReader(Server.MapPath( "news ") + "\\sj.html ",System.Text.Encoding.GetEncoding( "GB2312 ")))
{
string str;
//读取指定的HTML文件模板
while ((str = sr.ReadLine()) != null)
{
strhtml.Append(str);
}
sr.Close();
}
}
catch (Exception err)
{
//异常处理 &nbs