Disallowed Parent Path

  • Thread starter Thread starter IIS
  • Start date Start date
I

IIS

Guest
There are two ways to reference a file in applications:

  • An absolute path (Ex: /folder/file)
  • A 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:

medium?v=1.jpg



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

medium?v=1.jpg

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.

Continue reading...
 
Back
Top