Hi friends
What is a "Virtual Directory"?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anuja PawarPosted Dec 27, 2011, 7:40 AM
Virtual Directory is the path that you specify in IIS which maps to the physical location of the content. This path then becomes the part of the URL.
For example, if you have a static file named start.htm which is contained inside a folder named example. When you map example to a website within IIS, it becomes a Virtual Directory. After that, once you associate an application pool to this virtual directory it becomes an Application. But, this was within IIS 6.
With IIS 6 as prospective in mind, the concept is pretty confusing as the difference is not that major. In IIS 6, the basic purpose for this feature was application isolation. Other than this , however, it provided the developers to make complex applications by using the extended feature within ASP and ASP.Net applications.
In IIS 7 however this is pretty different, for the good :)
For IIS 7, Application and Virtual Directory are two different objects and are different parts of the website hierarchy. Within IIS 7, every site must contain an application which will in turn contain one or more virtual directory.
Akshay TeotiaPosted Dec 26, 2011, 12:10 PM
Satyapriya NayakPosted Dec 21, 2011, 10:53 PM
A virtual directory represents a web application and it points to a physical folder in your computer.
A web application is accessed using a virtual directory name instead of a physical folder name. For example, if you have a web application called "Shopcart" in your machine, you will have a virtual directory for this web application. You will access your web application using the URL httP://localhost/Shopcart. If your virtaul directory name is "Test", then your web application url will be "http://localhost/Test".
Assume you have a web application called "Shopcart", created under the physical folder "C:\MyProjects\Shopcart".
You can go to IIS and see this virtual directory listed. Right click on this virtual directory name in IIS and see the properties. You can see that this virtual directory is pointing to the physical location "C:\MyProjects\Shopcart".
If you have a file called "File1.aspx" under the folder "C:\MyProjects\Shopcart\", then you can access this file using Internet Explorer with the URL "http://localhost/Shopcart/File1.aspx"
How to create a virtual directory ?
When you create a new web project using, a new virtual directory will be created automatically for you. This virtual directory will point to a new folder created under C:\Inetpub\wwwroot.
If you like to better organize your projects and files in your favourite folder, you must manually create a new folder for each project in your preferred location and convert it into a virtual folder manually.
There are couple of ways you can do this.
Method 1: Open the IIS. Right click on the node "Default Web Site" and select "new Virtual Directory". When it prompt you to enter the "alias", enter the virtual directory name you want(Eg: Shopcart). In the prompt for "directory", select the folder which you want to make a virtual directory (Eg: C:\MyProjects\Shopcart). Select other default values and press "Finish". Now you should be able to see your new virtual directory in IIS.
Method 2: In the explorer, go to the folder(Eg: C:\MyProjects\Shopcart) which you want to make a "virtual directory". Right click on the folder name and select "Properties". Select the tab "Web sharing" and select teh option "Share this folder". It will prompt you with a default Alias name same as the folder name (Eg: Shopcart). Simply select the default values and press "OK".
Please refer the below link
http://www.dotnetspider.com/AspNet-Tutorial-86.aspx
http://www.startvbdotnet.com/aspsite/extras/virtualdirectory.aspx
Thanks