Server-side Include reference

Contributed by
Rating: 5 stars5 stars5 stars5 stars5 stars / 5
July 01, 2000
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

Server Side Includes

SSI is sort of like using your HTML server as a cut and paste editor. Here is basically what happens when your server handles a request for an SSI document. 

  • The server reads the document and renders the requested document
  • It looks for the <!--#include directive merges their results into creating a finished document.
  • The document is then sent to the client browser.

What is nice about using them, if you maintain a very large site or use the same code over and over.  You can put the code in one file and the with one include statement in all other pages include this code. In the unix world, you have to enable the server to do this.  In the IIS world, you use the #include directive.   Either the files can be .inc, .txt or .asp.  I recommend using .asp extension.   All stuff is rendered through the asp.dll, then if you have a generic connection string or sensative server side code isn't sent to the client as if it was included in a .inc or .txt file. 

Basic Syntax

If the file you want to include in your page is located some where under your DocumentRoot directory (the one with your main index page), you can use the virtual type of include:

Include file in the same directory
<!--#include file="file.txt" -->

   or

Include file in the another directory
<!--#include virtual="/somedir/file.txt" -->

or
Include file in the ROOT directory
<!--#include virtual="/file.txt" -->
  for files under the root directory.

blog comments powered by Disqus
ASP CODE ARTICLES

- ASP Forms
- ASP: The Beginning
- Getting Remote Files With ASP Continued
- Inbox and Outbox Manipulation in ASP
- Relational DropDownList Using VB.NET
- Ad Tracking URL Hits
- Use ViewState to display one record per page...
- Send Email using ASP.NET formatted in HTML
- ASP File Explorer
- ASP/XML Interview questions by Srivatsan Sri...
- Pressing RETURN won't submit the form
- This shows how you get the TEXT of a combo r...
- Group Data by Adrian Forbes
- Multiple checkbox select sample
- Multiple checkbox select with all values sam...

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
 
 
 

ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials