The difference between "file" and "virtual"

Source: Internet
Author: User
Difference

When writing an ASP program, it is common to use the <!--#include virtual/file= "Path/filename"--> to embed a relatively independent file code into the current page. In actual use, many people do not understand the use of "file" and "virtual" , causing the page to execute when there will be errors. A brief description of the issue is given.

When using "file" , a relative path is used after the equal sign. The so-called relative path, is based on the current file folder as the starting point, through the path search, get other files (or folders) and the current file path relationship. when using "virtual" , an absolute path is used after the equal sign. absolute Path, is the site root directory as the starting point, through the path search, get the file (or folder) the full path.

These two definitions are not very well understood, for example: the site root directory for IIS settings is "c:\wwwroot\", a.asp file directory is c:\wwwroot\afolder,b.asp file directory is C:\wwwroot\bfolder, c.asp file directory is C:\wwwroot\afolder\cfolder, then a.asp as a starting point to find b.asp, followed by the path of C:\wwwroot\afolder, C:\wwwroot, c:\wwwroot\ Bfolder, and the search for c.asp, through the path is C:\wwwroot\afolder, C:\wwwroot\afolder\cfolder. As a result, the relative path of b.asp for a.asp is.. /bfolder, the relative path of a.asp for b.asp is.. /afolder。 When the a.asp file needs to be used"File"When the b.asp file is invoked, its statement should be written as<!--#include file= ". /bfolder/b.asp "-->。 Call C.asp, whose statement is<!--#include file= "cfolder/c.asp"-->。 And no matter when, a.asp, b.asp, c.asp the absolute path of these three files isC:\wwwroot\afolder, C:\wwwroot\bfolder, C:\wwwroot\bfolder\cfolder。 Therefore, use in the a.asp file"virtual"Call another two files, respectively<!--#include virtual= "/bfolder/b.asp"-->And<!--#include virutal= "/bfolder/cfolder/c.asp"-->。

Another thing to mention is the distinction between include and IFRAME. The former is to execute a relatively independent file code as part of the calling file code, which belongs to the ASP language and can only be used in ASP files. And the IFRAME is simply a separate file in the call file nested display, the two are completely independent, without any relationship, and the IFRAME belongs to the HTML language, in ASP, HTM, HTML and other files to call.



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.