Solved

Remap the path in a ISAPI extension running at IIS

Posted on 1997-10-05
5
536 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

762 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