Using Server Side Include Files
page 3 of 4
by Steven Smith
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 28158/ 36

Usage Recommendations
Anything that you will use on more than one page is a good candidate for placing in an include file. Menus should ALWAYS be include files if they are not in a separate frame (which is a whole different subject). Also, it is a good idea to declare all of the variables in your include files, so that all pages that call it using OPTION EXPLICIT will work.  (Actually, an even better practice is to always wrap everything you put in an include file in a Sub/Function -- this will avoid the possibility of having duplicate variable declarations if an include file happens to be included twice)

Microsoft has acknowledged problems with the "*.inc" naming convention of include files. It is possible for users to access the source code of these files, depending on what version of IIS you are running. The fix is to name all include files with the "*.asp" extension. A common naming convention is to append "inc" to the end of the filename before the extension. So for example, the standard include file with all of ADO's constant names is "adovbs.inc". This would be renamed to "adovbsinc.asp". Another common practice is to throw all of the include files for a web site into a "/include/" subdirectory off of the main page. This makes accessing them simple regardless of what directory you are accessing them from. By doing this, you can easily reference all of your include files using VIRTUAL paths, making it easier to maintain your site when you move ASP files from one directory to another (which would break FILE paths if the depth of the ASP file in the directory structure changed). One last note -- any server side Sub or Function that you might use on more than one page should go into an include file.


View Entire Article

User Comments

Title: f   
Name: f
Date: 2012-09-16 8:44:59 PM
Comment:
ff
Title: Trainer   
Name: Prajakta
Date: 2009-03-13 1:29:47 AM
Comment:
What is the disadvantage of include files over user controls?
Title: GUD   
Name: Raj
Date: 2005-12-12 4:54:20 AM
Comment:
ya very nice ya

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 2:05:33 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search