How to Enable Parent paths in classic ASP

  • What is Parent Paths
  • Error Codes
  • Solution

What is Parent paths?

Classic ASP Parent Paths let developers use relative addresses that contain “..” in the paths to files or folders. For example

<%
   Response.Write Server.MapPath("../example.asp")
   Response.Write Server.MapPath("../../example.asp")
%>

In case to include the file in a folder that uses a parent path:

<!--#include file="../examplclass/example.inc"-->
<!--#include file="../examplclass/example.asp"-->

Error codes are as follows

Server.MapPath() error 'ASP 0175 : 80004005'
Disallowed Path Characters
/test/example.asp, line 100
The '..' characters are not allowed in the Path parameter for the MapPath method.
Active Server Pages error 'ASP 0131'
Disallowed Parent Path
/test/example.asp, line 100
The Include file '../_fpclass/fpdblib.inc' cannot contain '..' to indicate the parent directory.

Solution

Using Virtual Path

<%
   Response.Write Server.MapPath("/test/example.asp")
%>
<!--#include virtual="examplclass/example.inc"-->

Enabling ASP Parent Paths

Open IIS Manager and navigate to the site or application where you want to configure parent paths, and then-double click the ASP feature.

In the list of ASP features, configure the Enable Parent Paths option. Set the Enable Parent Paths to True and Click Apply

Leave a Reply

Your email address will not be published. Required fields are marked *