经典 Asp 中的 ResolveUrl/Url.Content 等效项 [英] ResolveUrl/Url.Content Equivalent in Classic Asp

查看:25
本文介绍了经典 Asp 中的 ResolveUrl/Url.Content 等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 webform/mvc 中,我们可以使用脚本和链接,script src=" Url.Content("~/Scripts/util.js")"

In webform/mvc we can use script and links as, script src=" Url.Content("~/Scripts/util.js")"

谁能告诉我经典asp中的等价物是什么?

Can anyone tell me what is the equivalent in classic asp?

推荐答案

没有直接的等价物,甚至没有直接的方法来确定应用程序的虚拟路径.以下几个 VBScript 函数应提供该功能:

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:

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

这篇关于经典 Asp 中的 ResolveUrl/Url.Content 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆