Home | Submit an interview question | Filter by category | Filter by job function | Filter by company
 
Member Information
User Id
Password
 
Forgot Password
Technology Category
.NET (1202)
Languages (103)
Database (146)
Operating System (48)
Reporting (5)
Third-Party Tools (2)
Testing (91)
OOP (75)
Web Development (40)
Design Patterns (89)
General (9)
Networking (88)
Hardware (63)
Brain Exercise (2)
Others (37)
 Our Network
.NET Heaven
C# Corner
Interview Corner
Longhorn Corner
Mindcracker
VB.NET Heaven
Home » .NET » .NET
What is a "Virtual Directory"?
Posted by joby peter Jul 13, 2006
Viewed : 16107 times
Major Category : .NET
Minor Category : ASP.NET
Total Replies : 2
Become a Sponsor
 EDITORIAL ANSWER  
No Reply Yet
 ANSWERS BY USERS  

Jul 25, 2006

Virtual Directories

A sub-directory of a web-site in IIS can be either a physical sub-directory, or it can be a Virtual Directory that is logically mapped to that location. It really should not matter whether the directory is a physical sub-directory or a Virtual Directory, just like the location of the web-root isn't exposed. In most production cases, especially with shared web-hosts, you will only be able to create physical sub-directories, probably using FTP or similar tools.

If you open up the Internet Services Manager in your Administrative Tools, also called IIS Manager, and drill down you will see the logical structures. Physical directories are shown with a folder icon, while Virtual Directories are shown with a special folder icon that has a globe as part of the icon. You may also see another icon, either a box around a globe icon (Win 2K/XP) or a gear icon (W2003), which indicates the directory is an IIS Application.

IIS Applications

An IIS Application is a directory, physical or virtual, that has been setup in a manner that makes it logically independent from the rest of the web-site. Its purpose is basically to make sub-directories act just like real web-sites, which is very useful on Win 2K/XP Pro, but not really necessary on a Server. Its important to understand that you cannot create an IIS Application simply using FTP or similar tools -- and this is the cause of many ASP.NET problems.

So how do you create an IIS Application? First, VS.NET automatically makes all new web projects into IIS Applications, whether you want it to be or not. Otherwise, you need to use IIS Manager to create or setup an IIS Application, or get your web-host to do it for you (WebHost4Life.com has a tool for this). The easiest technique is to use IIS Manager to create a new Virtual Directory -- it will also be an IIS Application by default, which adds to the confusion.

Application Settings

The alternative is much more revealing, so you really need to try it yourself. Using the IIS Manager, select any directory and then go to its property pages, then go to the Directory tab (may be labeled Virtual Directory or Home Directory). The bottom half of this form will be labeled Application Settings and you will see either a Create or a Remove button -- if you see the Create button then it is not an IIS Application, if the Remove button then it is an IIS Application.

Notice that some of the other items are only available for IIS Applications: Application Name, Configuration, Application Protection, and possibly Unload. The Configuration button brings up a dialog to map file extensions to ASP.NET, or other processes, as well as options like session state enable and timeout. The Application Protection drop-down determines if this IIS Application is to be isolated in its own process, pooled with other apps, or in-process with IIS.

Application Details

An IIS Application is basically a logical web-site, isolated from all others, and this is true for both classic ASP and ASP.NET; there's just more to ASP.NET. This means that Application and Session variables are not shared with other IIS applications, and Server.Execute/Transfer also has some chances for failure, or at least some odd behavior, when the new url is in a different IIS Application. See the next article for the additional ASP.NET specific application details.

IIS Applications also have events that can be defined in a global.asa/asax file. Global.asa/asax events only get executed for IIS Applications, and only if the file is at the app-root -- note that "asa" stands for Active Server Application. IIS Applications start when the first page in them is requested, and continue to run until they are stopped, either manually with the Unload button, or due to timeouts or other constraints automatically applied in ASP.NET configuration.

joby peter
Jul 13, 2006

Virtual directories are aliases for directory paths on the server. It allows moving files on the disk between different folders, drives or even servers without changing the structure of web pages. It avoids typing an extremely long URL each time to access an ASP page.

  
1

 

 Hosted by MaximumASP  |  Found a broken link?  |  Contact Us  |  Terms & conditions  |  Privacy Policy  |  Advertise with us
Current Version: 2.2009.3.2
 © 1999 - 2009  Mindcracker LLC. All Rights Reserved