我遇到了#include asp文件的问题。我试图将以下文件添加到经典的asp页面中:
<%
Function URLDecode(sConvert)
Dim aSplit
Dim sOutput
Dim I
If IsNull(sConvert) Then
URLDecode = ""
Exit Function
End If
' convert all pluses to spaces
sOutput = REPLACE(sConvert, "+", " ")
' next convert %hexdigits to the character
aSplit = Split(sOutput, "%")
If IsArray(aSplit) Then
sOutput = aSplit(0)
For I = 0 to UBound(aSplit) - 1
sOutput = sOutput & _
Chr("&H" & Left(aSplit(i + 1), 2)) &_
Right(aSplit(i + 1), Len(aSplit(i + 1)) - 2)
Next
End If
URLDecode = sOutput
End Function
Function HTMLDecode(sText)
Dim I
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "<" , Chr(60))
sText = Replace(sText, ">" , Chr(62))
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function
%>
当我将它添加到身体时,它会按预期执行:
<!--#include virtual src=".../url-html-decode.asp"-->
但是,当正文中有另一个包含asp文件时,它将无法运行。我们正在使用teamsite cms。
有谁知道为什么会发生这种情况?
这是include.asp文件:
<%
dim URLlinks,appType,appAcceptURL,appCancelURL,pageActionLinks,dynamicCancelURL ,subPage,appBackURL,refid,appGid,pageHeader,pageActionButtons,dynamicBackURL, dynamicAcceptURL, dynamicCanceltURL
appType = Request.QueryString("SRC")
appBacKURL = Request.QueryString("CANCEL")
appAcceptURL = Request.QueryString("ACCEPT")
appCancelURL = Request.QueryString("CANCEL")
csrf = Request.QueryString("csrf")
appGid = Request.QueryString("gid")
subPage = Request.QueryString("subpage")
pageHeader = Request.QueryString("pageheader")
pageActionLinks = Request.QueryString("actionlinks")
dynamicBACKURL = appCancelURL & "?gid=" & appGid & "&" & csrf
dynamicAcceptURL = appAcceptURL & "?gid=" & appGid & "&" & csrf
dynamicCancelURL = appCancelURL & "?gid=" & appGid & "&" & csrf
If subPage = "true" Then
dynamicBACKURL=Request.QueryString("SUBCANCEL")
End If
URLlinks = "?SRC=" & appType & "&pageheader=" & pageHeader & "&actionlinks=" & pageActionLinks & "&csrf=" & Server.URLEncode(csrf) & "&SUBCANCEL=" & Server.URLEncode(Request.ServerVariables("URL") & "?" & Request.Querystring & Request.Form )& "&ACCEPT=" & Server.URLEncode(appAcceptURL) & "&gid=" & appGid & "&subpage=true"
Dim user_agent, Regex, match
user_agent = Request.ServerVariables("HTTP_USER_AGENT")
Set Regex = New RegExp
With Regex
.Pattern = "(ipad)"
.IgnoreCase = True
.Global = True
End With
If appType = "BASE" Then %>
<link type="text/css" href="/css/base.css" rel="stylesheet" media="screen, projection, print" />
<%
end if
match = Regex.Test(user_agent)
If appType = "APP" Then
If match Then %>
<link type="text/css" href="/css/ipad.css" rel="stylesheet" media="screen, projection, print">
<% end if
end if
Set Regex = New RegExp
With Regex
.Pattern = "(iphone)"
.IgnoreCase = True
.Global = True
End With
match = Regex.Test(user_agent)
If appType = "APP" Then
If match Then %>
<link type="text/css" href="/css/iphone.css" rel="stylesheet" media="screen, projection, print">
<% end if
end if
Set Regex = New RegExp
With Regex
.Pattern = "(android)"
.IgnoreCase = True
.Global = True
End With
match = Regex.Test(user_agent)
If appType = "APP" Then
If match Then %>
<link type="text/css" href="/css/android.css" rel="stylesheet" media="screen, projection, print">
<% end if
end if
If appType = "WEBKIT" Then %>
<link type="text/css" href="/css/touch.css" rel="stylesheet" media="screen, projection, print">
<% end if
If subPage = "true" Then %>
<script>subpage=1;</script>
<% end if %>
我已将这两者集成到一个include.asp页面中,但只有在正文中没有其他<% %>
标记时才有效。我可以获得两个包含文件的唯一方法就是将它放在body标签之后,但是cms人员说由于网站发布者她不能这样做。奇怪。此外,在第二页中引用第一页的<!-- include virtual src=etc"-->
不起作用。
有关这种陌生感的任何想法?
我试着这样做:
<script language=vbscript runat=server src=/asp/url-html-decode.asp"></script>
但我收到以下错误:
microsoft vbscript编译(0x800A0400)预期声明/asp/usrl-html-decode.asp,第1行&gt;
为什么我收到此错误?对不起这里的详细信息。