04 2008 档案

ASP.NET生成静态页面实现方法
     摘要: protected override void OnInit (EventArgs e)
{
  int id;
  try
  {
    id = int.Parse (Request.QueryString["id"]);
  }
  catch
  {
    throw (new Exception ("页面没有指定id"));
  }
 
  string filename=Server.MapPath("statichtml_"+id+".html");
 
  //尝试读取已有文件
  Stream s = GetFileStream (filename);
  if (s != null)//如果文件存在并且读取成功
  {
    using (s)
    {
      Stream2Stream (s, Response.OutputStream);
      Response.End (  阅读全文

posted @ 2008-04-18 16:03 叶雨冰星 阅读(67) | 评论 (0)

<2008年4月>
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

导航

统计

常用链接

留言簿(1)

随笔档案

新闻档案

相册

搜索

最新评论