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

<2026年2月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
1234567

导航

统计

常用链接

留言簿(1)

随笔档案

新闻档案

相册

搜索

最新评论