How to create a virtual directory in IIS

From GXtest Wiki
Revision as of 08:37, 28 March 2011 by Ftoledo (Talk | contribs)

Jump to: navigation, search


A virtual directory is a server's directory that is not within the usual publishing directory, i.e. a directory that does not depend on C: \ Inetpub \ wwwroot but that it can be accessed through the web server as if it were within that directory.


To access IIS just type an address like this: http://localhost. This will go to the directory C: \ Inetpub \ wwwroot, which is called directory. The virtual directory is accessed with something like http://localhost/virtual_directory, but, the directory could be anywhere else on your hard drive, e.g. C: \ my_pages.


Virtual directories can be mapped to another directory on our hard drives or even to another directory on another computer on the network.


Create a virtual directory

First access the IIS Manager (Run-> inetmgr), or from Control Panel -> Administrative Tools -> Internet Information Server

Inetmgr.png

To define a virtual directory, you can press the right mouse button on the website and select "New > Virtual Directory ...". Then a wizard that will guide us step by step through the process will appear.

Inetmgr create.PNG

The first step of the wizard asks the alias or logical name that we give the directory (for example AjaxSample).
The second step asks us the physical location of the directory on your hard disk or local network (eg: c: \ Applications \ AjaxSample \).
Finally, we request that we want to assign permissions to that directory. Read permission and the execution of scripts (eg ASP) are usually enough for most cases.

Inetmgr permision.PNG

Once the wizard is finished, the virtual directory is created and can be accessed via the alias we've selected.