Microsoft Windows IIS FTP Part 2 - Directories Virtual/Physical

In previous section, we discussed the ways to use the hidden power of Microsoft's FTP server product. We talked about ways to leverage virtual directories along with Windows user accounts.

Virtual Directories

A virtual directory is nothing but an alias to some physical location (actual directory). Think of a person having a full name and an alias. The person does not disclose his full name, instead alias is provided. This person when visits some other area can give other people his/her another alias. In short alias is a virtual directory whereas full name is a physical directory.

Virtual directories are usually used to control the clients effectively. We will take one step further and discuss how to work with the IIS FTP quirks with using virtual directories as . . . yes, virtual directories. Because Microsoft has this unique way of utilizing virtual directories to offer more control, it also means that simply using virtual directories for their original purpose isn't as obvious as it should be.

Third Rule: IIS FTP Virtual Directory can't be seen by a FTP program

If we want to create a virtual folder that points to a different location on a server, one of the first things we will notice is that if we create the virtual directory in IIS FTP and then use a FTP client to log in, we won't see the folder!! We can use ChgDir if our FTP client supports it and type in the name of the virDir but that's often times not good enough. We want to actually see it.

Let me explain it further. Consider the following folder structure where d:\myftp\mysite\ is the FTP root path:

d:\myftp\mysite\ d:\myftp\mysite\images\ d:\myftp\mysite\bin\ d:\myftp\mysite\admin\

Now, let's create a virtual directory in IIS FTP called downloads which will point to:

e:\downloads\

When we log into our FTP account, we will see images, bin and admin but we won't see downloads.

Why is that? Since virtual directories aren't always used for their original purpose, as we saw in last section, they don't automatically appear. The other reason is that FTP programs will scan the files and folders on disk to determine what to display. Since virtual directories don't reside at the folder level, they won't be shown with the rest of the folders.

So what do we do? Fortunately the solution is simple.

Tip 2: Create an empty “physical” directory to have a “virtual” directory appear in a FTP program

Since the FTP client program will check for files and folders on disk, simply create an empty folder on disk where the virtual directory should show up. In example above, it means creating an empty folder called d:\myftp\mysite\downloads\. Now, after you log into this FTP account with your FTP program, you will see images, bin, admin and downloads. If you double click on downloads you will be taken to e:\downloads because the virtual directory in IIS FTP will take precedence.

Fourth Rule: If both a Virtual Directory and Physical Directory exist, the Virtual Directory takes precedence

In example above, I've created a “virtual“ folder which redirects to another location on the server, and a “physical“ folder so that it will show up in my FTP program. Even if I put files in the empty downloads folder, I won't be able to access them by double clicking on the downloads folder. Instead of being directed to d:\myftp\mysite\downloads\ (physical folder) I will be directed to e:\downloads\ (virtual folder).

In summary, when creating a virtual directory that should show up in the FTP client program, make sure to create an empty physical directory to match.

In last section, we covered working with Virtual Directories and Windows Users. In this Part we covered working with Virtual Directories and Physical Directories. In Part 3 and Part 4 we will cover IIS6 User isolation (and why I don't use it) and some tricks for more advanced configurations.

Did this tutorial help a little? How about buy me a cup of coffee?

Buy me a coffee at ko-fi.com

Please feel free to use the comments form below if you have any questions or need more explanation on anything. I do not guarantee a response.

IMPORTANT: You must thoroughy test any instructions on a production-like test environment first before trying anything on production systems. And, make sure it is tested for security, privacy, and safety. See our terms here.