#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ファイルがある場合は実行されません。チームサイトの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 %>
<% %>
これらの両方を 1 つの include.asp ページに統合しましたが、本文に他のタグがない場合にのみ機能します。両方のインクルード ファイルを機能させる唯一の方法は、body タグの直後に配置することですが、cms 担当者は、サイトの発行者のためにそれを行うことはできないと言っています。変。また<!-- include virtual src=etc"-->
、1 ページ目を 2 ページ目に参照するとうまくいきません。
この奇妙さについて何か考えはありますか?
私はこれをやろうとしました:
<script language=vbscript runat=server src=/asp/url-html-decode.asp"></script>
しかし、次のエラーが表示されます。
Microsoft vbscript のコンパイル (0x800A0400) 予期されるステートメント /asp/usrl-html-decode.asp、1 行目 %>
このエラーが発生するのはなぜですか? ここで冗長で申し訳ありません。