1、首先做好模板,在页面中标识好哪里放标题,哪里放正文。
2、发布信息时读出模板文件,再用正则表达式把标题和正文换成发布的信息。
3、以当前时间组织成文件标题存为2007032912121.html

解决方案 »

  1.   

    将你的aspx生成的页面保存起来WebClient web = new WebClient();
    web.DownloadFile("http://localhost/mypage.aspx", "20070303.html");
      

  2.   

    前面加 using System.IO;public  StreamWriter sw=null;string val="";
    string str_Sql="select E_Memo from Example";
    SqlDataReader rs=conn.GetDr(str_Sql);
    if(rs.Read())
    val=rs["E_Memo"].ToString();  //取模版
    rs.Close();            
    val=val.Replace("$Date$",str_Date);//产生日期
    val=val.Replace("$Newsid$",str_Newsid);//新闻标题
    val=val.Replace("$Title$",str_Title);//新闻标题
    val=val.Replace("$Content$",str_Content);//新闻内容
    val=val.Replace("$Zznews$",str_ZzNews);//作者
    val=val.Replace("$Nfrom$",str_Nfrom);//来源
    val=val.Replace("$About$",str_About);//相关新闻try 
    { //str_Url是保存的页面位置(绝对位置)
    sw = new StreamWriter(str_Url , false, System.Text.Encoding.GetEncoding("GB2312")); 
    sw.Write(val); 
    sw.Flush(); 

    catch
    {
    return "产生页面出错!";
    }