Asp classic 我需要用经典的asp代码创建asp.net的副本。请建议
我需要下面的asp.net代码的经典asp代码 asp.net-System.Environment.MachineNameAsp classic 我需要用经典的asp代码创建asp.net的副本。请建议,asp-classic,Asp Classic,我需要下面的asp.net代码的经典asp代码 asp.net-System.Environment.MachineName asp.net Server.MapPathasp Server.MapPath不支持像asp.net版本那样在URL开头解析“~/”。这是我去年在这里发布的代码: Function UrlContent(sUrl) If InStr(1, sUrl, "~/") = 1 Then UrlContent = ApplicationPath &a
asp.net Server.MapPathasp Server.MapPath不支持像asp.net版本那样在URL开头解析“~/”。这是我去年在这里发布的代码:
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
UriContent
获取传入的URL并解析“~/”以返回相对于主机网站的URL。因此,与ASP.NET代码等效的映射路径是:
Dim physicalPath : physicalPath = Server.MapPath(UrlContent(virtualPath))
获取计算机名要困难得多,因为您需要访问windows API。名为“server_NAME”的服务器变量只是请求中使用的主机名,因此它与实际的windows计算机名不同
创建允许脚本访问环境的.NET COM互操作dll相当容易