Name

#include

Synopsis

<!-- #include PathType = "strFileName" -->

The #include Server-Side Include allows you to insert the contents of a given file into the HTML content or ASP script. You must surround the #include Server-Side Include statement in an HMTL comment. Otherwise, the text of the Server-Side Include will be displayed as straight text.

Parameters

PathType

The type of path specified in the strFileName parameter. The possible values for PathType are described in the following table:

PathType Value

Description

File

Treats the value of the strFileName parameter as a relative path from the current directory

Virtual

Treats the value of the strFileName parameter as a full virtual path

strFileName

The strFileName parameter represents the name of the file whose contents you want inserted into the HTML content.

Introduced with IIS 5.0, there is a second way to include a file. You can use the <SCRIPT> tag combined with the SRC attrribute using the following format:

<SCRIPT LANGUAGE = "VBScript" RUNAT=SERVER SRC="strFileName">
</SCRIPT>

In the preceding code, the strFileName parameter is the same as that used with the INCLUDE directive and can be an absolute or relative path.

Example 1

The following script contains only a simple "back to top" line of code and a horizontal line with a graphic.

<!--ReturnTop.INC -->
<CENTER>
<HR>
Click <A HREF = #top>here</A> to go back to the top of the page.<BR>
<IMG SRC = "/Images/CorpLogo.GIF"></CENTER><BR>

We could now include this file anywhere ...

Get ASP in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.