Virtual directories in IIS

What are virtual directories, their use and how to define them.

A virtual directory is a directory on the server that is not inside the normal publishing directory, that is, a directory that does not depend on C:\Inetpub\wwwroot but can be accessed by the web server as if it were inside C:\Inetpub\wwwroot. said directory.

As we have already mentioned, to access our IIS we need to write an address like this: http://localhost. This accesses the C:\Inetpub\wwwroot directory, which is called the home directory. The virtual directory is accessed with something like http://localhost/virtual_directory, but an on-disk mapping of this directory does not have to exist within the publish folder, ie the directory C:\Inetpub\wwwroot does not have to exist. \virtual_directory, but said directory could be anywhere else on our hard drive, for example C:\my_pages.

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

Create a virtual directory

To define a virtual directory, you can right-click on the website where you want to define it and select the option “New > Virtual Directory…”. Then a wizard appears that will guide us step by step in the process.

The first step of the wizard asks us for the “alias” or logical name that we want to give to the directory. The second step asks us for the physical location of that directory on our hard drive or on the local network. Finally, it asks us for the permissions that we want to assign to that directory. Read permission and script execution permission (eg ASP) are usually sufficient for most cases.

See also  Notepad always gives me the .txt file extension

Once the wizard is finished, the virtual directory is created and we can access it through the alias we have selected.

Loading Facebook Comments ...
Loading Disqus Comments ...