[英]ResolveUrl/Url.Content Equivalent in Classic Asp
In webform/mvc we can use script and links as, script src=" Url.Content("~/Scripts/util.js")" 在webform / mvc中我们可以使用脚本和链接,脚本src =“Url.Content(”〜/ Scripts / util.js“)”
Can anyone tell me what is the equivalent in classic asp? 谁能告诉我经典asp中的等价物是什么?
There is no direct equivalent, there isn't even a direct way to determine the applications virtual path. 没有直接的等价物,甚至没有直接的方法来确定应用程序的虚拟路径。 The following couple of VBScript functions should provide the feature:
以下几个VBScript函数应该提供以下功能:
Function UrlContent(sUrl)
If InStr(1, sUrl, "~/") = 1 Then
UrlContent = ApplicationPath & Mid(sUrl, 2)
Else
UrlContent = sUrl
End If
End Function
Function ApplicationPath()
Dim pos: pos = Len(Request.ServerVariables("INSTANCE_META_PATH")) + 6
ApplicationPath = Mid(Request.ServerVariables("APPL_MD_PATH"), pos)
End Function
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.