I
IIS
Guest
There are two ways to reference a file in applications:
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:
Solution
There are two solutions to fix this issue:
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:
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...
- 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:
Solution
There are two solutions to fix this issue:
- Use absolute paths instead of relative paths
- 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:
- Click on the website name in IIS Manager
- Double click ASP icon
- Set “Enable Parent Paths” to “True“
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...