tags:

views:

53

answers:

3

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 object 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?

+1  A: 

Here is a page describing how and when you can access the ServerVariables in the global.asa.

Obalix
Oh yeh that is really nice. Thanks for the link.
Rob Segal
+1  A: 

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("./")
Rob Segal
A: 

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.

Simon B.