如题,如何实现,给个思路,先谢谢了!

解决方案 »

  1.   

    主页:
    <a href=newsa-list.aspx?id=<% = myDataSet.Tables("newsa").Rows(inti).Item("id") %> > &nbsp <%= myDataSet.Tables("newsa").Rows(inti).Item("contenttop") %>  显示页:
    newsa-list.aspx
    从数据中读出内容即可
      

  2.   

    自动生成html就可以了
    http://www.aspxboy.com/code
    代码比较烂,但是思路就是那样
      

  3.   

    1.要一个Html页面模板
    如:
    <html>
    <head></head>
    <body>
    <table width="550" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
      <tr bgcolor="#FFFFCC">
        <td width="76" align="center">标题:</td>
        <td width="451">{$NewsTitle$}</td>
      </tr>
    </table>
    </body>
    </html>
    ;-------------------------------------
    ; 其中的{$NewsTitle$}为需要替换的变量
    ;-------------------------------------2.后台中,从数据库中查询到附和条件的记录后,载入模板文件,用数据库中的值替换相应的模板文件中设置的变量,然后生成静态文件
      

  4.   

    参考生成静态的HTML代码: public static bool WriteFile(string strText,string strContent,string strAuthor) 
      {
       string path = HttpContext.Current.Server.MapPath("/news/");
       Encoding code = Encoding.GetEncoding("gb2312");
       // 读取模板文件
       string temp = HttpContext.Current.Server.MapPath("/news/text.html");
       StreamReader sr=null;
       StreamWriter sw=null;
       string str="";  
       try
       {
        sr = new StreamReader(temp, code);
        str = sr.ReadToEnd(); // 读取文件
       }
       catch(Exception exp)
       {
        HttpContext.Current.Response.Write(exp.Message);
        HttpContext.Current.Response.End();
        sr.Close();
       }
      
       
       string htmlfilename=DateTime.Now.ToString("yyyyMMddHHmmss")+".html";
       // 替换内容
       // 这时,模板文件已经读入到名称为str的变量中了
       str =str.Replace("ShowArticle",strText); //模板页中的ShowArticle
       str = str.Replace("biaoti",strText);
       str = str.Replace("content",strContent);
       str = str.Replace("author",strAuthor);
       // 写文件
       try
       {
        sw = new StreamWriter(path + htmlfilename , false, code);
        sw.Write(str);
        sw.Flush();
       }
       catch(Exception ex)
       {
        HttpContext.Current.Response.Write(ex.Message);
        HttpContext.Current.Response.End();
       }
       finally
       {
        sw.Close();
       }
       return true;此函数放在Conn.CS基类中了
    在添加新闻的代码中引用 注:工程名为Hover
     
        if(Hover.Conn.WriteFilethis.Title.Text.ToString),this.Content.Text.ToString),this.Author.Text.ToString)))
        {
         Response.Write("添加成功");
        }
        else
        {
         Response.Write("生成HTML出错!");
        }
    -------------------------------------------------------------------------
    模板页Text.html代码
    -------------------------------------------------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
     <HEAD>
      <title>ShowArticle</title>
      
     <body> biaoti
     <br>
     content<br>
     author
     </body>
    </HTML>
      

  5.   

    不建议使用自动生成HTML(感觉这个太笨了。不够灵活)有一种解决方法。就是重写URL。比如http://website/shownew.aspx?id=1,重写为http://website/shownew/1.aspx这样用户看到的URL是http://website/shownew/1.aspx,也方便用户记。而且最主要的就是它具有比直接写成html更具有灵活性在 ASP.NET 中执行 URL 重写http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx
      

  6.   

    如果你会使用xml,那就可以直接使用xml+xslt来直接做,