生成静态页

using System.Text;

    try
            {
                using (StreamWriter sw = new StreamWriter(Server.MapPath("01.htm"), false, System.Text.Encoding.GetEncoding("GB2312")))
                {
                    sw.WriteLine("" + user2.Name + "," + user2.Pwd + "");
                    sw.Flush();
                    sw.Close();                   
                }
            }
            catch
            {
                Response.Write("The file could not be wirte:");
            }

 

说明:如果站点根目录不存在01.htm,会自动建立该文件,可以配合NVelocity的标签使用,将需要缓存的数据存到01.htm,然后调用数据时直接通过模版NVilocity的include方法包含此子模版即可。

 

posted @ 2009-11-09 16:26  Silver.Lee  阅读(155)  评论(0编辑  收藏  举报