What is a virtual directory ?

Discussion about windows hosting plans offered by Hostriples. Issues and solutions on Plesk control panel, emails, MySQL and MS SQL Databases, asp.net, Coldfusion, phpmyadmin, MS Access, ODBC, GD library and much more.
hrdedicated
Site Admin
Posts: 50
Joined: Thu May 30, 2013 10:28 pm

What is a virtual directory ?

Postby hrdedicated » Sat Jun 01, 2013 7:45 am

Hello,

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".




Thank you.

Return to “Windows Shared Hosting Services Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests