Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Included file can not be in other dircetory, same hierarchy?

Status
Not open for further replies.

avivit

Technical User
Jul 5, 2000
456
IL
I have an asp file in "a" directory and tried to include there an asp file, which is located
in "b" directory which is in the same hierarchy as "a"
(i.e. - both r sub-directories of the same dircetory).
I can't do it on the server, but does work on pws.

Is there any restriction regarding the location of the included file?
 
what code are you using to #include the file? Can we see please. Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
<%@ Language=VBScript enablesessionstate=false%>
<%Response.Buffer=true%>
<!--#include file=&quot;../Scripts/xxx.asp&quot;-->
<%...
%>
<html>
<body>
........

********************************************
And in the included file I only wrote one line for test,
which should be seen as a note in html src code of
the asp page that included it.

<%
response.write(&quot;<!--reached the included page..-->&quot;)
%>
 
I was right. Read it :)
I found the following quote that claims exactly what I had problem with:

&quot;People tend to a mistake with include file, regarding the difference between:
<!--#INCLUDE VIRTUAL=&quot;head.asp&quot;-->
and
<!--#INCLUDE FILE=&quot;head.asp&quot;-->
When you use the key word VIRTUAL you say to ASP that the file you want to include is located in the root dir of your web server, if you use the FILE key word you tell ASP that the file to include is located in the SAME directory as the ASP file you have the include statement in. &quot;
**********************************************
I used a sub-directory and works as well, but can not include from another directory from root (while my directory is also from root).

Thanks
 
I was quoting all, but meant the part regatding the non-virtual reference. Have never used virtual.

I found a note regarding the non-virtual reference:
***************************************************
&quot;An interesting note: you can use the ../ syntax with the file keyword to include a file in a parent directory. Why is this interesting? IIS is the only webserver I've seen that allows you to do that! (Of course, I've not used many.) According to the NCSA HTTPd documentation, the #include file cannot contain ../. I guess Microsoft is just doing its own thing here. One side effect of allowing developers to use include files in parent directories is that you can include files outside of your web site!

You can only do this if you have the Enable Parent Paths turned on.&quot;

****************************************************
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top