MSDN Article: One Site, Many Faces

Today is a milestone of sorts, my first article is now live on the MSDN Developer Center! I'm happy with it for a few reasons. First, the topic is thoroughly lazy -- how to build a content management system that can serve up pages based on the extension thrown at it. Want to serve .rtf, .txt, or .rss files that users can save without frigging with an .aspx extension? Here's how. Want to serve your whole site as .htm instead of .aspx (like if you're a Sun shop and want to pretend you don't run IIS)? Here's how. Want to throw in versions for PDAs and printers? Here's how.

Second, all this is demonstrated three times in the article's source, with equivalent code in a global.asax, HttpHandler, and an HttpModule. Want to know which was fastest? Check out the article.

Third, I as able to sneak in a good bit on design. Sure you can jump straight to implementation -- the second half is all hands-on how-to. But in the first half I was able to walk through four stages of my own manner of design -- identification, entity design, system design and context, as applied to the task at hand. The basic approach is to strip as much decoration as possible from the design process. It isn't glamorous, the buzzwords are plain, the point is to get the job done. More examples will flesh out the concepts better, for now it was nice to kick out a sample.

A note on installation. The three versions are found in three folders: “SybilModule,” “SybilHandler,” and “SybilGlobalAsax.” There folders are placed in a location of your choice during installation. Each is intended to run (one at a time) in a virtual folder named simply “Sybil.” So create this folder in your webroot, set it as an application, and copy whichever version you wish to try into it.

Thanks to Kent Sharkey for the encouraging, the hounding, and fixing the spelings, and to Marcie for liking the sound of “Fjorbes Magazine” as much as me. Enjoy!

Further Resources:

Rewriting the URL
Provide Custom Hierarchical URLs (Jonathan Goodyear and Robert Lair)
.Text UrlRewriting - The IHttphandlerFactory Approach (by Scott Watermasysk)
Suppressing Extensions Entirely (by Ian Griffiths) -- Nifty. Solves issues of handling postbacks in URLs without periods, propagating querystring parameters and forms authentication.

No Comments