The SSI command allows you to insert the content of a file to another file before the Web server processes it. ASP only uses the # include command in this mechanism. To insert a file into the. asp file, use the following syntax:
<! -- # Include virtual | file = "filename" -->
The virtual and file keywords indicate the types of paths used to include the file. filename is the path and name of the file you want to include.
Private File extensions are not required for included files. However, it is a good programming habit to assign A. inc extension to included files so that they can be distinguished from other types of files.
Use Virtual keywords
Use the Virtual keyword to indicate that the path begins with the Virtual directory. For example, if a file named Footer. inc belongs to a virtual directory named/Myapp, the following line inserts the content of Footer. inc into the file containing the row:
<! -- # Include virtual = "/myapp/footer. inc" -->
Use the File keyword
Use the file keyword to indicate the relative path. The relative path begins with the directory containing the file. For example, if your file is located in the directory Myapp and the file Header1.inc is located in MyappHeaders, the following line inserts Header1.inc into your file:
<! -- # Include file = "headers/header1.inc" -->
Note that the path to the contained file Headers/header1.inc is relative to the contained file. If the script containing the # include statement is not in the/Myapp directory, the statement does not work.
If the "Enable upper-level directory" option in Internet service manager is selected, you can also use the file keyword and./syntax to include files in the parent directory, that is, files in the upper-level Directory. For commands, see configure ASP applications.
Location of the contained file
The contained files can be stored in a directory on your Web site or outside your Web site. Generally, you should place the contained files in the directory of the Web site. If a file to be included is located in your website, the next request by the browser to include the file will show changes to the file to be included. However, this change can only be reflected if the contained file is outside your Web site until the ASP Application is restarted or the Web server is restarted. ASP detects changes to any contained files in the application namespace (under the application's initial directory.
Contains files: prompts and warnings
A contained file can also contain other files. If the # include command does not cause loops, A. asp file can include the same file multiple times. For example, if the First. asp file contains the Second. inc file, Second. inc cannot contain the First. asp file. A file cannot contain itself. ASP detects such loops or nested errors, generates an error message at the time of detection, and stops processing the requested. asp file.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service