Using Global.asa correctly is a common problem for ASP developers. The main thing is to know when to use virtual application, when to use virtual directory, and to know their differences.
Virtual directories (dummy directory)
In short, virtual directories is fictitious, not necessarily with web root in the same directory, can be other. But you can use it just as you would with other directories on the Web root. When you run Global.asa, the ASP sees all the virtual directories as subdirectories on the application's root directory.
It is worth noting that if your directory is already a physical directory on website Root, then there is no need to make a virtual directory for that directory. Of course, you can do it as well. If the path to your directory is really too long to grow to you can't stand it, think about it a little shorter. You can use the method of building a virtual directory. Make it shorter and easier to remember. For example: The original directory Http://mysite.com/directory1/directory 2/file.asp, you can build a virtual directory for it, http://mysite.com/directory2/file.asp. This is more convenient.
Virtual applications (dummy application)
Virtual applications is a Web applications independent of website, and it is not necessarily a directory on Web root, just like virtual directories. It can be virtual from other directories. ASP does not allow applications to share their application and session variables, in other words, application A cannot access application B (including Web root, because Web root is also considered the root of an application.) Application and session variables, they are private. Vice versa. When you are sure that the application does not need to share application and session variables with the entire website, website on other subdirectories, or if you want to isolate a process in the same memory space to run the application. You are right to use virtual applications.
One thing to note: Virtual directory (virtual directories), created by the New Virtual Directory Wizard in IIS 4.0, defaults to a fictitious application (a dummy application). To change it back to virtual directory, you can select the Directory tab in the directory's properties, and click Uninstall.
Use multiple Global.asa carefully
Using multiple Global.asa in a website, we have to be careful, because it's very easy to lose a variable out of scope. Usually we have to limit the Global.asa trees on the entire website and put one in each application's root directory. This is a good way to keep session and application variables, not to lose them. By placing global.asa files on each directory, the ASP files that I tested can help us understand their relationship.
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.