Get root directory in ASP Classic application
I have several relative paths in my ASP Classic application. I'd like to get a reference to the root directory of my particular application (since the root of the server is som开发者_高级运维ething different) for the purpose of setting paths.
Is there a way to do this?
Have you tried
<%= Server.MapPath("/") %>
Use Request.ServerVariables("APPL_MD_PATH")
or Request.ServerVariables("APPL_PHYSICAL_PATH")
.
I found a way to do it using some server variables. Can anyone vouch for any possible bugs this way?
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
精彩评论