常常有那样的规定,依据不一样的需求规定include不一样的文件如每个人的不一样设置,因此 规定能动态include文件受<! #include file="filename.asp" --> 宏限定
    务必存有该文件而且会事先编译程序(无论前边是不是多方面标准)

    常常有那样的规定,依据不一样的需求规定include不一样的文件
    如每个人的不一样设置,因此 规定能动态include文件。

    编码以下:

Function include(filename)
 Dim re,content,fso,f,aspStart,aspEnd
 set fso=CreateObject("Scripting.FileSystemObject")
 set f=fso.OpenTextFile(server.mappath(filename))
 content=f.ReadAll
 f.close
 set f=nothing
 set fso=nothing
 set re=new RegExp
 re.pattern="^\s*="
 aspEnd=1
 aspStart=inStr(aspEnd,content,"<%") 2
 do while aspStart>aspEnd 1 
 Response.write Mid(content,aspEnd,aspStart-aspEnd-2)
 aspEnd=inStr(aspStart,content,"%\>") 2
 Execute(re.replace(Mid(content,aspStart,aspEnd-aspStart-2),"Response.Write "))
 aspStart=inStr(aspEnd,content,"<%") 2
 loop
 Response.write Mid(content,aspEnd) 
 set re=nothing
End Function

应用案例:

include("youinc.asp")