Scott Hanselman

XHTML Validating HttpModule for ASP.NET 2

March 30, '06 Comments [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
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web
Friday, March 31, 2006 4:48:34 AM UTC
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!
Friday, March 31, 2006 7:14:32 AM UTC
Hi Scott,

Thanks for the link, glad you like the Module.

I've posted a reply to your question over on theJoyOfCode.com: http://www.thejoyofcode.com/Validator_Module_on_Computerzen.com.aspx

Josh
Friday, March 31, 2006 11:53:19 AM UTC
That IS handy! I think I'll use this module sometimes, if it's as effective as it look likes!
Friday, March 31, 2006 6:36:47 PM UTC
"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 :)
Sergio Pereira
Comments are closed.

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