Today I had to move an ASP application I developed some years ago to a new hosting provider. After uploading all the files, I discovered that the application had an error in the includes.
Active Server Pages, ASP 0131
Disallowed Parent Path
This error is caused by a configuration in IIS that many hosting providers use, that disallows includes of type file with relative paths to a parent folder, like this:
<#include file="../../path_to_include">. The only solution is to replace all those includes with virtual includes with absolute paths such as:
<#include virtual="/path_to_include">. This is a very annoying process because basically you have to edit by hand each individual file and include, because the absolute path depends on the including page's path and the included page's path. If you have a web application with hundreds of files, like I did, this is not an option. A full description of the error is available here.
So I developed a mini-utility to do this for me. You give it a start folder which should be your app's root folder, and it searches for all .asp files, replacing the file="" relative paths with virtual="" absolute paths.
Using the code
It is written as a console app in C# .NET 2.0. To run it, just copy it somewhere, open a command line, and execute:
where path is the path to your root path, such as "c:\projects\client website\". Please note that the path is surrounded by double quotes because the path contains spaces and it ends with a trailing backslash.
I hope this can be useful to someone else.