Scott Hanselman

XHTML Validating HttpModule for ASP.NET 2

March 31, 2006 Comment on this post [4] Posted in ASP.NET | HttpHandler | HttpModule | Tools
Sponsored By

I just love the ASP.NET pipeline. It's so flexible. There's such power to be had when using HttpModules and HttpHandlers together. Here's a good example:

Josh Twist over at JoyOfCode has a "Validator Module" that sits at the very end of the HttpRequest and validates the page you just rendered as XHTML or not, then displays the detailed results. If you've ever found it a hassle to run XHTML validation on your site at runtime you should take a look at this clever idea. With tools like this ValidatorModule plus validation within Visual Studio.NET always improving as well as tools inside of FireFox to validate, there's fewer and fewer excuses to not render XHTML.

Try it out on Josh's site, pound on his demo, and leave him some feedback. You can add it to your .NET 2.0 applications without recompiling. He's also expressed that he could backport it to .NET 1.1 if there's demand.

Sigh, one day my site will be XHTML...until then, consider me transitional. Now, the real question, is it better to look good (render correctly) or feel good (be XHTML)?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Hosting By
Hosted in an Azure App Service
March 31, 2006 8:48
The correct answer is both :)

It would be very wild to have a module that reformats the rendered output as XHTML... strap a SgmlReader on that bad boy and off you go!
March 31, 2006 11:14
Hi Scott,

Thanks for the link, glad you like the Module.

I've posted a reply to your question over on

March 31, 2006 15:53
That IS handy! I think I'll use this module sometimes, if it's as effective as it look likes!
March 31, 2006 22:36
"is it better to look good (render correctly) or feel good (be XHTML)?"
For now, until XHTML support is consistent across the major browsers and renders as desired, it's just a bragging feature of a site, which most users will probably not care about.
So, to answer your question from my point of view, I'll leave another one:
In your site, it's more important to please the users or to please the techie in you?
One day we will not have to ask such questions :)

Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.