Disallowed Parent Path

This post has been republished via RSS; it originally appeared at: IIS Support Blog articles.

There are two ways to reference a file in applications:

  • An absolute path (Ex: /folder/file)
  • relative path (Ex: ../folder/file)

If you use a relative path in your ASP code, you may come across to “Disallowed Parent Path” error if your IIS server is not configured properly.

 

Examples of include statement using a relative path:

 

<!--#include file="../file.asp"--><% Response.Write Server.MapPath("../example.asp")%>

 

 

This error message shows up as “500 – Internal Server Error”. To find out the actual reason, use Failed Request. Here is what I found in my case:

clipboard_image_0.jpeg

 

Solution

There are two solutions to fix this issue:

  1. Use absolute paths instead of relative paths
  2. Allow the usage of relative paths (IIS doesn’t allow it by default)

In most cases, the second option (Changing the IIS configuration) is preferred as it provides a faster solution.

 

Follow the steps below to allow relative paths so that IIS doesn’t throw “Disallowed Parent Path” error anymore:

  1. Click on the website name in IIS Manager
  2. Double click ASP icon
  3. Set “Enable Parent Paths” to “True

clipboard_image_1.jpeg

Refer to this Microsoft article for more information on ASP parent paths. It was written long time ago for IIS 6 but it still applies to newer IIS versions.

Leave a Reply

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

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.