Solved

Remap the path in a ISAPI extension running at IIS

Posted on 1997-10-05
5
535 Views
Last Modified: 2010-04-04
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)
0
Comment
Question by:chrb
  • 3
  • 2
5 Comments
 
LVL 1

Expert Comment

by:buemoh
ID: 1346862
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.

0
 

Author Comment

by:chrb
ID: 1346863
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
0
 
LVL 1

Expert Comment

by:buemoh
ID: 1346864
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.


0
 
LVL 1

Accepted Solution

by:
buemoh earned 70 total points
ID: 1346865
Use an extra path, as I discripted in my las comment, like this

www.myserver.com/scripts/myscript.dll/chr/guestbook

then you'll find in the environment variables the following content

PATH_INFO = /chr/guestbook
PATH_TRANSLATED = drive:\path to the file\and the file itself

If you need more details, contact me - bye
0
 

Author Comment

by:chrb
ID: 1346866
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?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question