This is a quick tip. Below is the code that you can use when you want to find what's the name of the Virtual Directory.
string
virtualDirectory =AppDomain.CurrentDomain.FriendlyName;
virtualDirectory = virtualDirectory.Substring(virtualDirectory.LastIndexOf(
"/"));
virtualDirectory = virtualDirectory.Substring(0, virtualDirectory.IndexOf(
"-"));
Notes: This has been tested in IIS 6. If you run this code in ASP.NET Dev Server you'll get an exception as CurrentDomain.FrienlyName will not contain any '/' (no virtual directory).