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 叶雨冰星 阅读(79) | 评论 (0)

<2026年5月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

导航

统计

常用链接

留言簿(1)

随笔档案

新闻档案

相册

搜索

最新评论