Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

asp.net - ResolveUrl/Url.Content Equivalent in Classic Asp

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...