Sometimes when developing web applications it is useful to have them live at the root of the web space instead of a virtual directory (which is the default for Visual Studio).  This is not always the case these days, but when I was still doing a lot of classic ASP development, I would often need this.  Since XP Pro only allows one web site (as opposed to Windows 2000/2003 Server, which allows multiples), I spent a lot of time loading IIS, going to the properties page, and changing the “Home Directory” for the web site.

Maybe it’s because my computer was crappy, or maybe there was too much other stuff in memory, or maybe it’s always this way, but IIS was slow to load, plus that seemed like a lot of clicks for something so simple.  So, a long time ago I wrote a simple utility in VB6 (to help me deal with this.  Then as I was learning .NET, I re-wrote it as a WinForms app (including the designer generated code, it’s all of 157 lines of VB.NET).  In a nutshell, it lets you choose a new folder to be the webroot on your local machine.  Additionally, it keeps a history of directories used (in a text file) so that you can easily switch back to another in the future.

For me, the main benefits were that it loads much quicker than the IIS console, and that there are not as many clicks needed, especially if you’re just switching back to a previously used web root.  But it’s far from perfect, so here are a couple ideas for possible future improvement (if I ever work on it again):

  • Also copy virtual driectory and IIS application settings when changing web roots.  Currently, only the web root itself is changed with this utility.  All virtual directories are left unchanged.  This may be good, or it may be bad, but there should be an option.
  • Build a more complete console, similar to IIS, based on something like Cassini.  This could allow multiple web applications to be running at the same time, each at the root of their own web site.  Of course, this will take away the simplicity that currently exists, so I don’t know how much I like this idea.
  • Possibly some integration with the HOSTS file.  I’m not sure what I would want here, but it might make sense.

So anyway, take it for what it’s worth.  Use it if you want.  As always, use it at your own riskHere is the ZIP download.  Aside from this post, there are no docs of any kind — you’re on your own.  If anyone is interested in source, I can supply that as well, or you can just use Reflector.  It’s pretty basic, but if you want to make any improvements (my ideas or your own), I’d like to see the result.

I rarely use this anymore, but it came to mind again recently, so I thought I’d post it in case it might be of use to someone else.