動態頁面靜態化

2022-01-11 11:34:06 字數 1025 閱讀 1068

下面是乙個頁面轉換的類,該類通過靜態函式changfile()來實現,然後配合iis rewrite實現動態頁面到靜態頁面的轉換,並能主動控制頁面重新整理。

using system; 

using system.data;

using system.configuration;

using system.web;

using system.web.security;

using system.web.ui;

using system.web.ui.webcontrols;

using system.web.ui.webcontrols.webparts;

using system.web.ui.htmlcontrols;

using system.text;

using system.io;

/// /// summary description for htmlproxy

///

public class htmlproxy

public static bool changefile(int id)

}else

}return true;

}catch }}

private static stream getfilestream(string filename)

return new filestream(filename, filemode.open, fileaccess.read, fileshare.read);

}catch

}static public void streamtostream(stream src, stream dst)

}}

//在頁面檔案中,forurl.aspx的後台**如下:

protected void page_load(object sender, eventargs e)

else

}catch

}

動態頁面靜態化

一 tomcat的過濾器 最典型的就是用 urlreweite的類庫.1.將所需的urlrewrite x.x.x.jar放在web inf lib中 修改web.xml增加過濾器,然後配置個過濾的規則就可以了web.xml修改部分 urlrewritefilter org.tuckey.web.f...

動態頁面靜態化

動態變靜態 方法一 使用現成的 外掛程式,比如 isapi rewrite iis rewrite apache http伺服器的mod rewrite等,它們都是基於 正規表示式解析器開發的重寫引擎。它們的使用方法檢視它們自帶的幫助即可。方法二 自己寫的 實現動態網頁靜態化,方法也有好幾種 1 建...

動態頁面靜態化之頁面靜態化方案

動態頁面靜態化之頁面靜態化方案 在大型 中,訪問者看到的頁面基本上是靜態頁面。為什麼都要把頁面靜態化呢?把頁面靜態化,好處有很多。例如 訪問速度快,更有利於搜尋引擎收錄等。目前主流的靜態化主要有 兩種 一種是通過程式將動態頁面抓取並儲存為靜態頁面,這樣的頁面的實際存在於伺服器的硬碟中,另外一種是通過...