Link to home
Start Free TrialLog in
Avatar of chrb
chrb

asked on

Remap the path in a ISAPI extension running at IIS

Hi,
I am writting a ISAPI extension, but how can I get the real path the a virtual directory. For example I send a path to the script /mydir/myfile.html. The I want to find where it is at the HD. Thanks!

(Sorry my bad english)
Avatar of buemoh
buemoh

There are some usefull environment variables, like

PATH_INFO
PATH_TRANSLATED
DOCUMENT_ROOT
SCRIPT_NAME

Notice, it depends for which httpd server you are creating the ISAPI extension DLL, because not all server set all variables correct.

PWS sends always the WWW server document root, the real path, in the environment variable PATH_TRANSLATED.

Avatar of chrb

ASKER

The path i want to find out has nothing with the path to where the script is. The querystring may contain :
www.myserver.com/script/myscript?dir=/chr/guestbook
Then I want to find out the real path for /chr/guestbook, with PWS i have found out that i saves the homedir and virtuals path in the registry, dos IIS this.

(Sorry my bad english)

Chr
Why do you use this (?)

www.myserver.com/script/myscript/chr/guestbook

because the term /chr/guestbook is an extra path and  can be found in the PATH_INFO variable and then PATH_TRANSLATED gives you the correct "real" path on your server.

example:

www.myserver.com/scripts/test.dll/wwwroot/test.html

the variables have the following content
PATH_INFO = /wwwroot/test.html
PATH_TRANSLATED = c.\webshare\wwwroot\test.html

I think IIS stores also anything in the registry, but I don't know it exactly and you shouldn't use the registry to find out where your file is located!!

May be, this is what you need.


ASKER CERTIFIED SOLUTION
Avatar of buemoh
buemoh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chrb

ASKER

Well, I want to know the real path to a directory, you can't do that with that. With that you show me you need a file.
Did you understand?