【发布时间】:2011-03-28 14:47:48
【问题描述】:
我的 ASP Classic 应用程序中有几个相对路径。为了设置路径,我想获取对我的特定应用程序的根目录的引用(因为服务器的根目录不同)。
有没有办法做到这一点?
【问题讨论】:
标签: asp-classic path directory
我的 ASP Classic 应用程序中有几个相对路径。为了设置路径,我想获取对我的特定应用程序的根目录的引用(因为服务器的根目录不同)。
有没有办法做到这一点?
【问题讨论】:
标签: asp-classic path directory
你试过了吗
<%= Server.MapPath("/") %>
【讨论】:
使用Request.ServerVariables("APPL_MD_PATH") 或Request.ServerVariables("APPL_PHYSICAL_PATH")。
【讨论】:
Request.ServerVariables("APPL_PHYSICAL_PATH") 为我工作。谢谢!
我找到了一种使用一些服务器变量的方法。任何人都可以以这种方式保证任何可能的错误吗?
function getRoot()
pathinfo=Request.ServerVariables("PATH_INFO")
Set myRegExp = New RegExp
myRegExp.IgnoreCase = True
myRegExp.Global = True
myRegExp.Pattern = "^(/\w*/).*"
' Pop up a message box for each match
getRoot = myRegExp.Replace (pathinfo, "$1")
end function
【讨论】: