Is it possible to access Request object from Global.asa file?
I need to get access to some server variables like APPL_PHYSICAL_PATH
from the the Global.asa
file. I can do this on any page of my site using the Request
o开发者_运维百科bject as follows...
Request.ServerVariables("APPL_PHYSICAL_PATH")
But I don't seem to have access to the Request
object within the Global.asa
file. Is there an equivalent call I can do here with the Server
object?
Well I've found an alternative for what I want to do. I can get the equivalent of...
Request.ServerVariables("APPL_PHYSICAL_PATH")
by using
Server.MapPath("./")
if vartype(Request.ServerVariables("REMOTE_ADDR"))=8 then
'xxxx'
end if
Long and now unneccessary suggestion follows. Didn't want to trash it :-p
Since one Application instance can include several virtual directories which would map to different physical paths, you can't get the exact same. Probably you could find an automation object (*) to install in your server, then make an instance (for example with Server.CreateObject) and interrogate it for the path to the main application, i.e. ignoring any virtual directories.
(*) Suggested automation objects; something that can read the IIS Metabase.
精彩评论