Solved

Asp Include file from Parent directory

Posted on 2006-06-16
2
565 Views
Last Modified: 2013-11-18
Active Server Pages error 'ASP 0131'

Disallowed Parent Path

/www/folder/home.asp, line 2

The Include file '../index.asp' cannot contain '..' to indicate the parent directory.

******************************
I have been using information from : http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_10354572.html?query=asp+include+a+file+in+parent+directory&clearTAFilter=true 

I am trying to get a file from the parent directory to include. Can anyone tell me why it is working for some people and not me?

<!--#include file="../index.asp"-->
0
Comment
Question by:cipiWeb
2 Comments
 
LVL 23

Accepted Solution

by:
basicinstinct earned 150 total points
ID: 16919250
From here:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q226474

RESOLUTION
The best solution to the problem is to use absolute virtual paths from the root of the Web site instead of relative paths.

For example, if you use an include file named "mycode.inc" at the root of your server, the virtual path would be "/mycode.inc." If you use the same include file in a virtual directory named "/includes" on your server, the virtual path would be "/includes/mycode.inc."

The syntax example below illustrates how to implement virtual paths:

<!--#include virtual="/<virtual path>/<filename.ext>"-->
                              

An alternative to using absolute virtual paths is to enable parent paths; however, this is not the preferred method. (See the notes in the More Information section for details.) This is accomplished for your default Web site by using the following steps:
1.      Open the Internet Services Manager in the Microsoft Management Console (MMC).
2.      Right-click on your Default Web Site and select Properties.
3.      Click the Home Directory tab.
4.      Click the Configuration button.
5.      Click the App Options tab.
6.      Click to select the Enable Parent Paths checkbox.
7.      Click the OK button until you return to the MMC.
0
 

Author Comment

by:cipiWeb
ID: 16919459
Awesome, it works. (ended up turning on parent paths.) but I would still like to make sure I understand the virtual includes, mainly... how do they differ from file?

This is a wild guess, but does file work relative to the file with the include script and virtual works relative to the domain root?

What is the difference between a virtual directory and a real directory? ( Folder )
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

777 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