Click here to Skip to main content
13,404,383 members (44,132 online)
Click here to Skip to main content
Add your own
alternative version


19 bookmarked
Posted 4 Nov 2007

Utility to convert file includes to virtual includes

, 4 Nov 2007
Rate this:
Please Sign up or sign in to vote.
A utility to convert file includes to virtual includes.

Screenshot - ConvertFile2Virtual.jpg


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:

ConvertFile2Virtual.exe path

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.


  • v1.0 - Initial release.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Bruno Gazzera
Web Developer
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralIIS 6 and IIS 7 default settings for 'Parent paths' Pin
deeps000012-Nov-07 22:12
memberdeeps000012-Nov-07 22:12 
AnswerRe: IIS 6 and IIS 7 default settings for 'Parent paths' Pin
Bruno Gazzera21-Nov-07 11:43
memberBruno Gazzera21-Nov-07 11:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.1802120.2 | Last Updated 4 Nov 2007
Article Copyright 2007 by Bruno Gazzera
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid