IIS Tweaks - Virtual Directories

When your using IIS to serve web pages what normally happens is you need to have all files which will be accessible over HTTP in the wwwroot folder of the server. What a virual directory will do is enable you to give the impression that a file is in a certain place on the server, when infact it could be somewhere else on the machines hard disk or on another networked system.

This was something I used when creating this site, my actual pages were stored in F:\Site\v2\Beta but I was able to access the files by going to http://localhost/site. There isn't really a need to use virtual directories unless your using content which is spread out.

To create a Virtual Directory you first need to open the IIS Managment Console, you can do this either from Administrative tools or by going to start > run and entering
%SystemRoot%\System32\inetsrv\iis.msc

Now expand either the default web site or ftp site which you wish to ad a virtual directory to, right click on it and select New > Virtual Directory. A wizard will now appear, click next and give your virtual directory an alias (this will be the name used to access the content, servername/alias). Click next and select the directory to point the virtual directory towards. Once you've selected a path and pressed next you will be asked to grant permission on this directory to read, run scripts, execute, write and browse. If you don't need to execute programs, write or browse do not check them. If Directory Browsing is checked it will allow the user to view a list of files in the virtual directory, which isn't always a good thing. Click next again, then finish and your directory has been created. You should now be able to access the content by going to http://localhost/alias_name

Note on an NTFS formatted drive IIS will respect the NTFS ACL restrictions placed on files, depending what your doing you might want to edit file permission or possibly need to add the Internet User Guest Accounts (IUSR_MachineName).


Author:

Lex van der Horst

Date Added:

06-11-2004

Last Reviewed:

06-11-2004