生成html靜態頁

2022-02-05 11:38:49 字數 1029 閱讀 1523

方案1:

///

/// 傳入url返回網頁的html**

///

/// url

///

public static string geturltohtml(string url)

// get the response stream.

system.io.stream respstream = wresp.getresponsestream();

// dim reader as streamreader = new streamreader(respstream)

system.io.streamreader reader = new system.io.streamreader(respstream, system.text.encoding.getencoding("gb2312"));

return reader.readtoend();

} catch(system.exception ex)

return "";

} 你可以用這個函式獲取網頁的客戶端的html**,然後儲存到.html檔案裡就可以了。

方案2:

生成單個的靜態頁面不是難點,難的是各個靜態頁面間的關聯和鏈結如何保持完整;

特別是在頁面頻繁更新、修改、或刪除的情況下;

像阿里巴巴的頁面也全部是html的,估計用的是位址對映的功能

關於位址對映可參考:

可以看看這個頁面,分析一下他的「競價倒計時」功能

biaoti

content

author

biaoti

content

author

提示新增成功後會出以當前時間為檔名的html檔案!上面只是把傳遞過來的幾個引數直接寫入了html檔案中,在實際應用中需要先新增資料庫,然後再寫入html檔案

方案3:

給乙個客戶端參考的例子(sj)

它的作用在於以客戶端的方式獲取某個頁面的**,然後可以做為其他用途,本例是直接輸出

生成html靜態頁

方案1 傳入url返回網頁的html url public static string geturltohtml string url get the response stream.system.io.stream respstream wresp.getresponsestream dim re...

生成html靜態頁

方案1 傳入url返回網頁的html url public static string geturltohtml string url get the response stream.system.io.stream respstream wresp.getresponsestream dim re...

ASPX頁生成靜態HTML頁

商品detail資訊頁面都是html頁面,減少訪問資料庫的次數,提高效能 方案1 傳入url返回網頁的html url public static string geturltohtml string url get the response stream.system.io.stream resp...