When we typically generate HTML static pages, we often do a template in advance and then call the template file when we generate it. Then there is no way to use templates, such as a normal htmer.asp page, directly into the htmer.html page? Of course it can, and it's very simple, today I'll teach you how to generate HTML static pages without templates in ASP.
This assumes that there is a htmer.asp dynamic page, you want to make it into an HTML static page htmer.html, then we first create a new ASP program file Htmer_to_ Html.asp (the file is used to make the htmer.asp dynamic page into a static page htmer.html), the specific code for htmer_to_html.asp is as follows:
<form method= "POST" action= "" >
<textarea name= "asp2html" style= "Display:none" ><!--#include file= "Htmer.asp"--></textarea>
<input type= "Submit" value= "Generate HTML page"/>
</form>
<%
Dim filename,fso,fout
If Request.Form ("asp2html") <> "" Then
filename= "htmer.html"
Set fso=server.createobject (" Scripting.FileSystemObject ")
Set fout=fso.createtextfile (Server.MapPath (Filename))
Fout.write Request.Form ("asp2html")
fout.close
set fout=nothing
set fso=nothing end
If