我的ASP Classic应用程序中有几个相对路径。为了设置路径,我想获取对我的特定应用程序的根目录的引用(因为服务器的根目录是不同的)。
有没有办法做到这一点?
发布于 2010-08-12 06:17:15
我找到了一种使用一些服务器变量的方法。任何人都可以用这种方式保证任何可能的bug吗?
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发布于 2010-08-12 04:39:46
你试过了吗?
<%= Server.MapPath("/") %>发布于 2011-10-14 13:10:47
使用Request.ServerVariables("APPL_MD_PATH")或Request.ServerVariables("APPL_PHYSICAL_PATH")。
https://stackoverflow.com/questions/3462600
复制相似问题