对呀,就是一个单独的aspx文件.问题是怎么能够动态的出现文件名及其帖子标题

解决方案 »

  1.   

    我的意思是你不应该每次用户访问你的ASPX页面时,搜索所有的帖子文件重新生成这个文件列单,而是应该用什么脚本offline产生一个静态的文件,里面含有帖子文件名及其标题
      

  2.   

    but if you insist, try something like
    <%@ Import Namespace="System.IO" %>
    <script language="C#" runat="server">
    void Page_Load (Object o, EventArgs e)
    {
      string dirName = ".";
      string realDirName = Server.MapPath(dirName);
      DirectoryInfo di = new DirectoryInfo(realDirName);
      string sLine;  foreach (FileInfo fi in di.GetFiles("*.xml"))
      {

    //Response.Write(fi.FullName + "<BR>");
    StreamReader sr = new StreamReader(fi.Open( FileMode.Open, FileAccess.Read, FileShare.Read),
    System.Text.Encoding.GetEncoding("GB2312"));
    while ((sLine = sr.ReadLine()) != null)
      {
    if (sLine.IndexOf("TopicName")>=0)
    {
    sLine = sLine.Trim();
    sLine = System.Text.RegularExpressions.Regex.Replace(sLine,@"<[^>]+>","");
    string sPath = dirName != "."? dirName + "/" + fi.Name:fi.Name;
    //instead of outputting, you could append the content to a file
    Response.Write("<A HREF='" + sPath + "'>" + sLine + "</A><BR>");
    break;
    }
    }
    sr.Close();
      }
    }
    </script>
      

  3.   

    好办法,学习!这样就不用另一个数据库或xml文件啦,以前老是用到数据库或xml,
    ps:能不能在列出贴子时按最后更新时间来排序呢?
    how to?