在ASP中不用模板生成HTML静态页直接生成.html页面
我们一般生成HTML静态页时,常常会事先做好一个模板,然后生成时调用模板文件。那么有没有办法不用模板,如一个正常的htmer.asp页面,直接生成为htmer.html页面呢?当然是可以的,而且非常简单,今天就教大家在ASP中不用模板生成HTML静态页的方法。
这里假设有一个htmer.asp动态页面,你想把它生成为HTML静态页面htmer.html,那么我们首先新建一个ASP程序文件htmer_to_html.asp(该文件就是用来将htmer.asp动态页面生成为静态页面htmer.html的),htmer_to_html.asp的具体代码如下所示:
<formmethod="post"action="">
<textareaname="asp2html"style="display:none"><!--#includefile="htmer.asp"--></textarea>
<inputtype="submit"value="生成html页"/>
</form>
<%
DimFilename,Fso,Fout
IfRequest.Form("asp2html")<>""Then
Filename="htmer.html"
SetFso=Server.CreateObject("Scripting.FileSystemObject")
SetFout=Fso.CreateTextFile(Server.Mappath(Filename))
Fout.WriteRequest.Form("asp2html")
Fout.Close
SetFout=Nothing
SetFso=Nothing
EndIf
%>热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下