NCS Logo - Click for home page Northstar Developer Center
Platforms
All Platforms
.NET Framework (1.x - 4.x)
Active Server Pages
ASP.NET
C#
SQL Server
VB.NET
Visual Basic

Keywords
.NET Data Types
.NET E-mail
.NET Events
.NET Functions
.NET Object Programming
.NET System.Configuration
.NET System.Diagnostics
.NET System.IO
.NET System.Net
.NET System.Net.Sockets
Active Data Objects
ASP Architecture
ASP Black Belt
ASP Built-in Functions
ASP Built-in Objects
ASP Debugging
ASP Performance
ASP Security
ASP Syntax
ASP.NET Authentication
ASP.NET Controls
ASP.NET Data Access
ASP.NET Features
ASP.NET Master Pages
ASP.NET Page Events
ASP.NET Security
ASP.NET ViewState
Atom
Certifications
COM, DCOM, COM+
Data Access
E-Mail
Errors
Exporting Data
HTML Tips
IIS
Object-Oriented Programming
RSS
SQL
Uncategorized ASP Tips
VB API Programming
VB Forms
VB Syntax
XML

Book Support
Visual Basic 6 Bible
ASP Bible
ASP Weekend Crash Course
ASP.NET At Work
Creating Web Services

Using Include Files

Written by Eric Smith, Northstar Computer Systems LLC

This tip was included a few weeks ago, but there was some confusion about how to use it. Include files allow you to share code between files without having to duplicate the code everywhere. This has the added benefit of making it easier to modify, test, and maintain ASP code on an ongoing basis.

You can include a file in two ways:

1. If the include file is in the same directory as the file into which you want to include it, you can use this code:
<!–#include file="include.asp" –>
You can add directories to this specification, such as includes/include.asp; however, you can't include a leading slash.

2. If the include file is somewhere else in the web hierarchy, you can specify a web pathname to the include file like this:
<!–#include virtual="/includes/util.asp" –>
This is the easiest and cleanest way to implement an include file, since you don't have to worry about relative pathnames getting messed up if you move files around. Put all your include files in one place, if possible, and reference them from your ASP pages.

Keywords: [ Uncategorized ASP Tips ]

Publication Date: 9/1/1999