有没有办法使用asp变量在html中包含文件?

有没有办法使用asp变量在html中包含文件?

问题描述:

我想包括在HTML文件中,但我想用ASP来传递一个变量(即)有没有办法使用asp变量在html中包含文件?

<% Dim s = "file.html %> 
<!-- #include file="<% s %>"--> 

似乎并没有得以顺利,有没有解决的办法来获得上述工作?

IIS server side includes不支持变量。

查看documentation


一个解决方法是将读出的文件(使用FileSystemObject)到一个变量,并使用<%=%>输出直接到页。

会这样的工作吗?

<% if condition Then %> 
<!--#include file="File1.htm"--> 
<% elseif condition Then %> 
<!--#include file="File2.htm"--> 
<% end if %> 

这是怎么回事?

<% Server.Execute "" & s & ".html" %>