Closed Thread Icon

Topic awaiting preservation: ASP determine home directory... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12357" title="Pages that link to Topic awaiting preservation: ASP determine home directory... (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: ASP determine home directory... <span class="small">(Page 1 of 1)</span>\

 
KirbyWallace
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 08-09-2002 07:26

Platform: IIS, ASP, VBScript, JavaScript

For a given ASP script, I need to know the full file system path to that script.

For instance, a website is running in IIS in c:\inetpub\wwwroot\MYWEB and the default document is index.asp

When index.asp runs, I need something that will tell me that index.asp is being run from "c:\inetpub\wwwroot\MYWEB"

Why? Because index.asp needs to open a configuration file using the FSO to get certain PATH info to other files. This config file is in the same place as index.asp. If I know where index.asp is, then I can determine where the config file is.

Anyone know where to begin on this one?



someoneInverse
Bipolar (III) Inmate

From:
Insane since: May 2002

posted posted 08-09-2002 09:17

you can use either

strPath = Request.ServerVariables("PATH_TRANSLATED")
or
strPath = Server.MapPath("index.asp")

but it's probably best to go with the second one since there isn't the server overhead

hth
I:.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 08-09-2002 09:21

path = Server.MapPath(Request.ServerVariables("PATH_INFO"))

KirbyWallace
Nervous Wreck (II) Inmate

From:
Insane since: Dec 2001

posted posted 08-10-2002 03:24

I thank you both VERY much! I tried both approaches and both work very well. Is there one that's better than the other? They both work, but I'm thinking of going with .MapPath("index.asp") as it's a little more self explanatory to those who will inherit this code for maintenance.

Again, thanks to both of you!



someoneInverse
Bipolar (III) Inmate

From:
Insane since: May 2002

posted posted 08-12-2002 09:32

glad to help

fyi: the mappath("index.asp") approach is probably better, because when you call request.servervariables, the entire servervariables collection is retrieved, not just the variable you requested (just one of asp's little "features")

this makes for all sorts of scalability problems for web sites with a larger user audience, which is why I suggested that you might want to go with mappath("index.asp")

hth
I:.

« BackwardsOnwards »

Show Forum Drop Down Menu