ISAPI and path of the web

I have an ISAPI extension, which, among other things, parses a HTML file and modifies it. My problem is the use of path in the template file.
I'm running on a NT server with IIS4. My ISAPI is located in the /SCRIPTS directory and my web is called /NEWS. The structure of /NEWS is something like this:
/
/Images
/Ads

In my HTML template file, image references is in the form images/picture.gif. The problem is that when the ISAPI has processed the file, /SCRIPTS is the default directory and since there is no /images directory underneath, no pictures are shown in the browser. The only solution I have found so far, is to make the image reference like /news/images/picture1.gif, but adding the webname to the template file won't do, as the file are copied to a number of other webs on the same server and I don't want to edit each file everytime I change something.
Isn't there some like "/root-of-current-web" tag I can use? I can't use / since I have a number of webs on the server and / returns the IIS root.

I'll up the points for a good solution..
LVL 7
BlackManAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
mouattsConnect With a Mentor Commented:
If the script was executed from one of the pages withing /NEWS then you can use the environment variable HTTP_REFERER which gives the full url of the page from which your script, in this case, was executed. Thus you can strip down the file name and find the document directory.

If this is not the case then you could do the reverse of what I previously suggested and create a virtual directory under each web which pointed to your script directory and excute your script from there (ie /news/script) rather than from /script.

Steve
0
 
BlackManAuthor Commented:
And by the way, I have the same problem with links...
0
 
MasseyMCommented:
Have you tried /News/Images/whatever.gif?

Add the /News/ to the images/ path
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 
BlackManAuthor Commented:
Yes, but as I have a number of webs where this file is copied to at regular intervals, I don't want the web-name in the file ...
0
 
MasseyMCommented:
BlackMan, as I reread your question, you said that... Sorry.
0
 
BlackManAuthor Commented:
That's allright, at least I got a response :-)
0
 
mouattsCommented:
Create a virtual directory underneath SCRIPT that points to the images directory. It doesn't matter that the directory is referenced more than once within the configuration.

Steve
0
 
BlackManAuthor Commented:
That won't solve my problem, since each web must have it's own image-files as different users maintain them..
0
 
BlackManAuthor Commented:
mouatts, I'm still evaluating your answer, I'll be back in a few days...
0
 
BlackManAuthor Commented:
Your answer lead me to a solution, thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.