Generate HTML static pages directly without templates in ASP. html page _ Application Tips

Source: Internet
Author: User

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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.