SoFunction
Updated on 2025-04-13

No templates, just use ASP+FSO to generate static HTML pages

Replacing the template tags when FSO generates static HTML files has always been a very troublesome problem. At least that's what I think, don't make a template, please! , I saw today that there is a way to solve this problem

For example, a normal page, and use ASP code to call out the contents in the database, create another page, add a textarea field, assuming it is name="body", it will be called out in the textarea, such as:
<textarea name="body"><!--#include file=""--></textarea>, include this textarea in the form, and create an FSO object on the receiving form page, and generate a file as follows!

<%
filename="../"
if request("body")<>"" then
set fso = ("")
set fout = ((""&filename&""))
("body")

set fout=nothing
set fso=nothing
end if
%>

In this way, the file is generated, and there is no need for templates. Just read the ASP file used under normal circumstances into the textarea. No problems have been found yet! Of course, the premise is that the server must support FSO