she swears <i>geek</i> is a term of endearment

Sitemap Provider throws empty HttpException when reserved word is used for url

I ran across a strange bug today.  Fortunately, Bill saw it first and lead me straight to it.  I banged my head against it (unsuccessfully), trying to diagnose the cause of a System.Web.HttpException with no message being thrown from SiteNavNode.ChildNodes until my battery died on my laptop and then came into the office to continue.  Good thing!

In the Financial Services industry, there is a company with the symbol PRN.  I, of course, use directory urls to organize our dynamic website.  PRN is a reserved word for urls because it is a reserved file system word.  In my opinion, modern OS’s should not have this limitation, but I don’t know enough about it to suggest that it isn’t necessary.

If you attempt to create a file, with any extension, using the following list, it will fail to resolve in a browser.

Reserved Word

What it is

AUX Auxiliary port aka Serial Port COM1
CON Short for console, which Microsoft describes as the display monitor.
COM1 COM port.
COM2 COM port.
COM3 COM port.
COM4 COM port.
LPT1 LPT port.
LPT2 LPT port.
LPT3 LPT port.
NUL NULL
PRN Printer aka LPT1

This is also true of rewritten urls.  I defensively have incorporated a lovely "~" into any url that attempts to name the path segment using one of these reserved words. 

Leave a Reply