A summary of the difference between ASP #include file and #include virtual 1th/2 page _ Application Tips

Source: Internet
Author: User
The "relative path" here is relative to the folder where the "keynote file" is located.

#include file
#include file is followed by the "relative path" of the files, and "absolute path" is not allowed.
Use relative paths, such as: file= "Script\file.inc", file= "... \script\file.inc "
You cannot use an absolute path, such as: file= "\script\file.inc"
#include virtual
#include virtual can be followed by the "absolute path" of the file, you can also follow the formal "relative path" (the so-called "relative path", refers to the form of the path is "relative path", but it will be converted to "absolute path", so essentially "absolute path")

Use absolute path, such as: Virtual= "\folder\file.inc"
The use of formal "relative path", such as: Virtual= "Folder\file.inc", will be converted to virtual= "\folder\file.inc"

It is recommended to use the "absolute path" form, such as: Virtual= "\folder\file.inc", rather than write virtual= "Folder\file.inc", although this can be
Combining several examples, say the difference:
Copy Code code as follows:

Assuming that "Include files" and "included files" are in the same folder as the root directory named folder, then Virtual= "folder\file.asp" is OK, and file= "folder\file.asp" is wrong.
If a site has 2 folders under Folder1 and Folder2,folder1 files under File1.asp,folder2 file file2.asp, if file1.asp to invoke File2.asp, Then you can write this in file1.asp:
<!--#include virtual= "\folder2\file2.asp";
In this case, using the <!--#include file= "folder2\file2.asp"--> is wrong.

In the course of use, pay attention to the following points:

Whether using #include file or #include virtual, use a simple "/" or simply "\" or both to mix and use in the path.

such as: file= ". \script\file.inc ", file=". /script/file.inc ", file=". /script\file.inc "

#include file and #include virtual can only contain station files and cannot contain outbound files. For example, if you have a site named website, it is wrong to use virtual= "website\file.asp".
Current 1/2 page 12 Next read the full text
Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.