Because the code is relatively short, there is no comment here
Copy Code code as follows:
<%
' When the target page contains the file that is the #include page, there is response. End () There is a problem with this procedure
' NOTE: This file must be placed in the same directory as the 20041227111723.htm pointing file
Dim Hughchiu_rtcode
Function Get_exe_code (20041227111723.htm)
Dim Execode
Dim tmp_str
Dim Re,re1,content,fso,f,aspstart,aspend
Dim ms,m
Execode = ""
Set Fso=createobject ("Scripting.FileSystemObject")
Set F=FSO. OpenTextFile (Server.MapPath (20041227111723.htm))
Content=f.readall
F.close
Set f=nothing
Set fso=nothing
Set re = new RegExp
Re.ignorecase = True
Re.global = True
Re.pattern = "\<\%\@[^\%]+\%\>"
Content = re.replace (content, "")
Re.global = False
Re.pattern = "\<\!\-\-\s*\ #include \s*file\s*=\s*\" ([^\ "]+) \" "\s*\-\-\>"
Todo
Set ms = Re.execute (content)
If Ms.count<>0 Then
Set m = ms (0)
Tmp_str = Get_exe_code (m.submatches (0))
Content = re.replace (content, TMP_STR)
Else
Exit Do
End If
Loop
Set m = Nothing
Set ms = Nothing
Re.pattern= "^\s*="
Aspend=1
Aspstart=instr (aspend,content, "<%") +2
Set Re1=new REGEXP
Re1.ignorecase = True
Re1.global = False
Re1.pattern = "response\." Write (. +) "
Do While aspstart>aspend+1
Execode = execode&vbcrlf& "Hughchiu_rtcode = hughchiu_rtcode&" "&replace (replace (Mid content,aspEnd , aspstart-aspend-2), "" "" "" "" "" "", vbCrLf, "" &vbcrlf& "" "" & "" "&vbcrlf
Aspend=instr (aspstart,content, "%\>") +2
Tmp_str = Mid (content,aspstart,aspend-aspstart-2)
Todo
Set ms = Re1.execute (TMP_STR)
If Ms.count<>0 Then
Set m = ms (0)
Tmp_str = Re1.replace (Tmp_str, "Hughchiu_rtcode = hughchiu_rtcode&" &m.submatches (0))
Else
Exit Do
End If
Loop
Set m = Nothing
Set ms = Nothing
Execode = execode& Re.replace (tmp_str, "Hughchiu_rtcode = hughchiu_rtcode&")
Aspstart=instr (aspend,content, "<%") +2
Loop
Set Re1 = Nothing
Set re=nothing
Execode = execode&vbcrlf& "Hughchiu_rtcode = hughchiu_rtcode&" "&replace (replace (Mid content,aspEnd "" "" "" "" "" "" "" "" "" &vbcrlf& "" "", "" "" "" "" "vbCrLf" "" &vbcrlf
Get_exe_code = "<%" &execode& "%\>"
End Function
function asp2html (20041227111723.htm)
Dim code
Code = replace (replace (Get_exe_code (20041227111723.htm), "Hughchiu_rtcode = hughchiu_rtcode&" "" "" "& vbCrLf, ""), "<%", "" "),"%\> "," "")
' Response. Write (Code)
Execute (Code)
' Response. Write (Hughchiu_rtcode)
asp2html = Hughchiu_rtcode
End Function
%>
Use Example:
Copy Code code as follows:
Set Fso=createobject ("Scripting.FileSystemObject")
Set F=FSO. CreateTextFile (Server.MapPath ("youpage.htm"), true)
F.writeline (asp2html ("youpage.asp"))
F.close
Set F = Nothing
Set fso = Nothing