Includes tag in ASP 3.0

By vineed_menon ·
I am having an ASP application. I am having a asp page that includes another asp file. The application is to be hosted on the Internet with 'Enable Parent Paths disabled' i.e I cannot use '..' for referring to my root folder.

The folder structure of the application is as

--> ApplicationFolder (Virtual Directory)
-----> MasterPages (Folder)
----------> indexPage.asp
-----> includes (Folder)
----------> pageInfo.asp

I am constantly getting errors on the include tags the aspx page is having. I have used almost all combinations of include tags like

<!-- #include file = "~/includes/pageInfo.asp" -->
<!-- #include file = "~\includes\pageInfo.asp" -->
<!-- #include virtual = "/includes/pageInfo.asp" -->
<!-- #include virtual = "includes/pageInfo.asp" -->
<!-- #include virtual = "\\includes\\pageInfo.asp" -->

But all of these are giving me an 'include file not found error'. I have checked all the settings in IIS and I simply cannot understand what is the cause of this problem

Also I would like to state that I cannot use the name of the virtual directory with the include tags as there are chances that the name of the virtual directory might change.

If anyone knows what is the mistake I am making please let me know.



This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

I had the same issue yesterday and found this:

by gene.schafer In reply to Includes tag in ASP 3.0

From your examples you missed the one that will work. See below.

Server Side Includes (SSI)

The most commonly used alternative is using Server Side Includes (SSI). Setting these up is just the same as if you were using FP includes with a few minor differences. Many of these differences will also apply to other types of include which we will look at later, so I will go into some detail on them here.

First though, lets take a look at the code required to include content using SSI. This is what the SSI include directive looks like:

<!--#include file="page.txt" -->

This will work only if the file to be included is in the same directory as the final page, so, given that will usually not be the case, the more commonly used directive is:

<!--#include virtual="/directory/page.txt" -->


Related Discussions

Related Forums