Archive for July, 2011

Rename Applications and Virtual Directories in IIS7

Friday, July 29th, 2011

Note: this is a cross posting from my article at the foliotek devblog. This improves some of the code formatting.

Have you ever wondered why the box to change the name or “Alias” on an application or virtual directory is greyed out (see screenshot below)? I found a way to change the name without recreating all your settings. It uses the built in administration commands in IIS7, called appcmd.

Renaming Applications In IIS7

Open a command prompt to see all of your applications.

C:> %systemroot%\system32\inetsrv\appcmd list app
 
APP "Default Web Site/OldApplicationName"
APP "Default Web Site/AnotherApplication"

Run a command like this to change your “OldApplicationName” path to “NewApplicationName”. Now you can use http://localhost/newapplicationname

C:> %systemroot\%system32\inetsrv\appcmd set app "Default Web Site/OldApplicationName" -path:/NewApplicationName;
 
APP object "Default Web Site/OldApplicationName" changed

Renaming Virtual Directories In IIS7

Open a command prompt to see all of your virtual directories.

C:> %systemroot%\system32\inetsrv\appcmd list vdir
 
VDIR "Default Web Site/OldApplicationName/Images" (physicalPath:\serverimages)
VDIR "Default Web Site/OldApplicationName/Data/Config" (physicalPath:\serverconfig)

We want to rename /Images to /Images2 and /Data/Config to /Data/Config2. Here are the example commands:

C:> %systemroot%\system32\inetsrv\appcmd set vdir "Default Web Site/OldApplicationName/Images" -path:/Images2
 
VDIR object "Default Web Site/OldApplicationName/Images" changed
 
C:> %systemroot%\system32\inetsrv\appcmd set vdir "Default Web Site/OldApplicationName/Data/Config" -path:/Data/Config2
 
VDIR object "Default Web Site/OldApplicationName/Data/Config" changed

JavaScript Canvas.DrawWindow implementation

Friday, July 29th, 2011

I have implemented DrawWindow (HTML rendering) functionality in Canvas. It is essentially rendering HTML inside of the canvas tag without modifying the original DOM. This took a lot of trial and error, but it is working pretty well now. The code is online here: https://github.com/bgrins/DrawWindow, and a really minimal project page is here: DrawWindow demo.

I recently found a very good implementation of this same functionality, called html2canvas, that was just released. That implementation includes nice demos and a test console, so it is worth checking out. That version is quite a bit more polished, so when I work on mine more, I will have to check out some of the great work here: https://github.com/niklasvh/html2canvas.

This functionality is necessary for web design type applications that require a colorpicker based on the current DOM, or for feedback type applications that require sending screenshots. Great to see this being built out!