Is it possible to access the Request object from the Global.asa file?

I need to access some server type variables APPL_PHYSICAL_PATHfrom a file Global.asa. I can do this on any page of my site using the object Requestas follows:

Request.ServerVariables("APPL_PHYSICAL_PATH")

But I do not have access to the object Requestin the file Global.asa. Is there an equivalent call I can make here with an object Server?

+3
source share
3 answers

Well, I have found an alternative to what I want to do. I can get the equivalent ...

Request.ServerVariables("APPL_PHYSICAL_PATH")

using

Server.MapPath("./")
+4
source
if vartype(Request.ServerVariables("REMOTE_ADDR"))=8 then
    'xxxx'
end if
+1
source

, . : -p

Since a single application instance may include several virtual directories that will map to different physical paths, you cannot get the same. You could probably find an automation object (*) to install on your server, then create an instance (for example, from Server.CreateObject) and request it for the path to the main application, i.e. Ignore any virtual directories.

(*) Suggested automation objects; something that can read the IIS metabase.

0
source

Source: https://habr.com/ru/post/1737582/


All Articles