Date:  08/21/2006 01:39:05 PM Msg ID:  003127
From:  FoxWeb Support Thread:  003116
Subject:  Re: Script Mapping URL Problem
John,
 
You have spend way too much time on this issue -- mainly because you don't seem to fully understand how linked URLs work.
 
When a browser wants a resource from the server, it must know the fully-qualified URL for that resource, including the protocol (http, https, ftp, etc.), the server name, the path and the file name.  When the URL is included in HTML code returned by a script, then this URL does not need to have fully qualified, but can rather be an absolute, or even a relative URL.  I think your misunderstanding is related to what absolute and relative mean.  Both types of URLs are converted to fully qualified URLs, by combining them with the URL that was used to call the script.
 
Here's an example:
 
Assume that you have placed your script in the "testing" sub-folder of your FoxWeb program root.  In this case, in order to call your script, you would need to use http://servername/testing/myscript.fwx.  Also, let's assume that this script returns three image links, as follows:
 
<html><body>
1. <img src="http://OtherServer/picts/myimage.gif"><br>
2. <img src="/picts/myimage.gif"><br>
3. <img src="picts/myimage.gif"><br>
</body></html>
 
When the browser receives this HTML output, it will try to resolve the src attributes into fully qualified URLs.  Here's what it will try to download for each one of them:
 
1. http://OtherServer/picts/myimage.gif
2. http://servername/picts/myimage.gif
3. http://servername/testing/picts/myimage.gif
 
Pay particular attention to the difference between 2 and 3.  Number 2 is an absolute URL, so, even though the scripts is in the /testing sub-directory, the URL ignores this.  Number 3 on the other hand is a relative URL, so it takes /testing into account.
 
I hope this helps.

FoxWeb Support Team
support@foxweb.com email

Sent by John Sullivan on 08/21/2006 08:48:02 AM:
I got the image to display but I am not sure why. I changed the image reference to read as follows:

<img src="marketing4insurance/picts/mbm_zipcodes.jpg" width="100%" Height="150">
Ther images live with the rest of my static code in the virtual directory. The images are in the picts sub directory in the marketing4insurance virtual directory. Isn't that the way it needs to be set up?

I have C:\Inetpub\wwwroot\MARKETING4INSURANCE set up as a virtual directory with an alias of marketing4insurance. Is this correct and ok? Why do I need to put marketing4insurance as part of the path to the image?
 
Since the path is: C:\Inetpub\wwwroot\MARKETING4INSURANCE I thought any relative image reference would relatve to that path.

Does this mean references to javascipt and other images need to have marketing4insurance in front of them?

Please see my path / program setup below.

John Sullivan
Sent by FoxWeb Support on 08/20/2006 10:10:00 PM:
I'm not sure why you created a virtual directory in IIS for your images.  What's the virtual directory URL?  You can access the images without creating a virtual directory by setting the source to "/marketing4insurance/picts/mbm_zipcodes.gif".  In any case, as long as you are using an absolute URL (meaning, a URL that starts with a slash), then it makes no difference where you locate your script and what URL you use to access it.
 
Also, try the following URL: http://localhost/picts/mbm_zipcodes.gif.  Can you see the image?  If not, then the script code you posted cannot be working.  In this case, make sure to paste the exact (working) script code in your response.
 
Thanks,

FoxWeb Support Team
support@foxweb.com email

Sent by John Sullivan on 08/20/2006 09:56:33 PM:
All images are located in my web root which is:

C:\Inetpub\wwwroot\MARKETING4INSURANCE\picts\

This directory is set up as a virtual IIS directory

The scripts are located in a directory outside the web root. This directory is:

C:\M4i_Websites\MARKETING4INSURANCE\

This directory is specified as my default program root in the Virtual Servers tab in the FoxWeb Control Center.

I have tried every configuration of the script possible and still cannot get the image to view with the script located outside the web root.

Note: If I place the script in the web root and then change the Virtual Server tad check box to "Use Web Server's Direct" the image displays as expected.

The Foxweb DLL is located in the C:\Inetpub\Scripts directory. The FWX extention is correctly mapped to that DLL. The FoxWeb program is installed in its default directory.

What am I doing wrong? The script is as simple as I can make it. I have tested every scenario possible.

I will try any ideas you have. Thanks for your help.

John Sullivan



Sent by FoxWeb Support on 08/20/2006 07:11:46 PM:
You did not provide us with the location of your Web root, FoxWeb Program Root, directory where the images are located and directory where your scripts are located in each example.  This makes it harder to be certain of the problem, but I will try.
 
I assume that your script code remains the same in both examples.  The code uses "/picts/mbm_zipcodes.jpg" for the image source, which means that your images must reside in the picts sub-folder of your web root.  In order for both scenarios to work, the scripts must remain in that location.  Even if you move your script ourside the web tree, the images must remain there.

FoxWeb Support Team
support@foxweb.com email

Sent by John Sullivan on 08/20/2006 05:45:06 PM:
I am trying to get scripts located outside the web tree to work properly. The scripts run  but do not produce the expected browser output unless I place them in the web tree and then change the Foxweb  Control Center to reflect Use Web Server's Directory Mappings. Specifically, the image is outputted correctly when using script located in the web tree but not outputted when located outside the web tree.

I have read the Locating and Addressing Scripts many times but obviously I am missing something. Perhaps the following information will enable you to point me in the right direction.

Here is the setup. I used a simple Foxweb script and called it Zip_Test.Fwx. The script looks like this:

*** Foxweb Zip_Test.FWX TEST script*********************

<%
** The testinfo is outputted so I know I am in the correct script
TestInfo = "this is test #5"
%>
<html><head>
<title>Zipcode Search Page</title>
</head>
<body>
<img src="/picts/mbm_zipcodes.jpg" width="100%" Height="150">
<%=TestInfo%>
</BODY>
</HTML>

FIRST TEST - INSIDE WEB TREE - THIS WORKS

Using the “Use Web Server's Directory Mappings” in the Foxweb Control Center and with the script located in the web tree, the following URL works.

http://localhost/Marketing4insurance/ZIP_test.FWX    (this works)

Storing the Foxweb script in the web tree allows the graphic to display as expected.

NEXT TEST - OUTSIDE WEB TREE - THIS DOES NOT WORK

With  the “Use Web Server's Directory Mappings” UNCHECKED in the Foxweb Control Center, and placing the script in the directory specified in the Foxweb Control Center, the following URL DOES NOT WORK.

http://localhost/ZIP_test.FWX (This does not work – I reload the browser each time with a different test number to ensure the script recompiled and ran.)

I tried a variety of options for relative addressing and none works. These are:
 
<img src="\picts\mbm_zipcodes.jpg" width="100%" Height="150">
<img src="picts\mbm_zipcodes.jpg" width="100%" Height="150">
<img src=".\picts\mbm_zipcodes.jpg" width="100%" Height="150">
<img src="..\picts\mbm_zipcodes.jpg" width="100%" Height="150">
<img src="/picts/mbm_zipcodes.jpg" width="100%" Height="150">
<img src="picts/mbm_zipcodes.jpg" width="100%" Height="150">
<iimg src="../picts/mbm_zipcodes.jpg" width="100%" Height="150">
 
Do you have any suggestions on what to try next?

John Sullivan