This file must be existing in the macro limit and will be pre-compiled (regardless of whether it is conditioned in front)
There are often such requirements, requiring the number of different files such as the individual people according to different requirements, so it is required to dynamically include files.
code show as below:
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, Aspend-2) Aspend = INSTR (ASPSTART, Content, "% />") 2 Execute (Re.Replace (Content, AsPstart, Aspend-AspStart-2), " Respstart = INSTR (Aspend, Content, "<%") 2 loop response.write mid (content, aspend) set re = nothingend function
Use example:
Include ("Youinc.asp")