学院首页>网络编程>ASP.NET>Asp.net动态生成html页面

Asp.net动态生成html页面

作者: 来源: 添加时间:2006-5-21 20:00:15
{

  htmltext.Replace("$htmlformat["+i+"]",format[i]);

  }

  //----------生成htm文件------------------――

  try

  {

  using(StreamWriter sw=new StreamWriter("存放路径和页面名",false,System.Text.Encoding.GetEncoding("GB2312")))

  {

  sw.WriteLine(htmltext);

  sw.Flush();

  sw.Close();

  }

  }

  catch

  {

  Response.Write ("The file could not be wirte:");

  }

  小结

  用此方法可以方便的生成html文件。程序使用了是循环替换,因此对需替换大量元素的模板速度非常快。

第 3 页,共 3 页 [1] [2] [3]
站内搜索