Solved

Remap the path in a ISAPI extension running at IIS

Posted on 1997-10-05
5
523 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now