There are two ways to reference a file in your code: Using an absolute path (Ex: /folder/file) or using a relative path (Ex: ../folder/file). If you use a relative path in your ASP code but your IIS server is not configured properly, you may come across to “Disallowed Parent Path” error (ASP 0131 ASP_LOG_ERROR).
An example include
statement that uses a relative path:
<!--#include file="../file.asp"-->
Another example of the relative path usage:
<%
Response.Write Server.MapPath("../example.asp")
%>
This error message shows up as “500 – Internal Server Error” which is a generic error message IIS displays for code and configuration related issues. In order to dig deeper in the 500 error, enable Failed Request Tracing in IIS and collect logs.
Here is a sample Failed Request Tracing log that shows “Disallowed Parent Path” error:
Solution for Disallowed Parent Path error (ASP 0131 ASP_LOG_ERROR)
There are two alternative solutions to fix this issue:
- Change the application code to use absolute paths instead of relative paths
- Allow the usage of relative paths by changing configuration of IIS (By default, IIS doesn’t allow it)
In most cases, the second option (Changing the IIS configuration) is preferred because it provides a faster solution.
Allow Relative Paths in IIS
Follow the steps below to allow relative paths so that IIS won’t throw “Disallowed Parent Path” error anymore:
- Go to IIS Manager
- Click on the website name
- Double click ASP icon
- Set “Enable Parent Paths” to “True“
For more information on ASP parent paths, please refer to this Microsoft article. This article was written long time ago for IIS 6 and earlier versions but it still applies to newer IIS versions.
After changing the IIS configuration, you may come across a configuration file related error if the change hasn’t been done properly. Check this post out for step-by-step solution instructions: Configuration file is not well-formed XML (IIS Shared Configuration)