aspx生成靜態頁面

2021-05-23 17:32:22 字數 1327 閱讀 7717

前台**如下:(default.aspx)

後台**如下:(default.aspx.cs)(注:其中hover為web專案名)

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.io;

using system.text;

public partial class _default : system.web.ui.page

string htmlfilename = datetime.now.tostring("yyyymmddhhmmss") + ".html";

// 替換內容

// 這時,模板檔案已經讀入到名稱為str的變數中了

str = str.replace("showarticle", strtext); //模板頁中的showarticle

str = str.replace("biaoti", strtext);

str = str.replace("content", strcontent);

str = str.replace("author", strauthor);

// 寫檔案

trycatch(exception ex)

finally

return true;

protected void button1_click(object sender, eventargs e)

else}}

其中text.html**如下:

showarticle

biaoti

content

author

aspx頁面生成靜態頁面

通過aspx頁面生成靜態頁面,在 cs檔案重寫page的render方法,接收頁面通過請求返回的hmtl 然後再另存為 html模板 如下 方法一 把本頁面生成html頁面 protected override void render htmltextwriter writer 方法二 請求其它頁面...

aspx頁面生成詳解

當我們訪問asp.net網頁時,如果是第一次訪問,系統會編譯相應的網頁,編譯好的內容會存入 windows microsoft.net framework version temporary asp.net files 專案名稱 隨機數 隨機數 中,下面我們通過詳細分析這個編譯好的內容來學習aspx...

aspx頁面生成詳解

當我們訪問asp.net網頁時,如果是第一次訪問,系統會編譯相應的網頁,編譯好的內容會存入 windows microsoft.net framework version temporary asp.net files 專案名稱 隨機數 隨機數 中,下面我們通過詳細分析這個編譯好的內容來學習aspx...