XHTML Validation Module Checker for ASP.NET 2.0

Josh and Bruusi have a great .NET blog here

They've recently published a very cool XHTML Validation module for ASP.NET 2.0 that allows you to easily identify and catch any non-XHTML markup with your application.  You register it as an ASP.NET HttpModule within your app's web.config file, and then it watches and checks all page output for XHTML compliance: 

This makes it much easier to test different user-interaction scenarios that can't be easily verified with online XHTML validators (for example: pages that require someone to login, or which do posts, etc), and provides a really easy way to verify that your markup is standards compliant.  You can learn more about the XHTML Validation Module and download it for free here: http://www.thejoyofcode.com/Validator_Module.aspx

To learn more about building XHTML standards compliant sites with ASP.NET 2.0, make sure to also check out Stephen Walther's great article here.  You can also download a set of free XHTML and CSS based designer-built templates for ASP.NET 2.0 here (these provide an attractive set of UI templates that were built by a professional designer and which you can easily re-use within your own solutions for free). 

Hope this helps,

Scott

P.S. And one more reminder, the ASP.NET 2.0 CSS Control Adapter Toolkit that I mentioned in this upcoming releases post will ship later this month.

Published Sunday, April 09, 2006 11:03 AM by ScottGu
Filed under: ,

Comments

# re: XHTML Validation Module Checker for ASP.NET 2.0

Monday, April 10, 2006 3:54 PM by cowgaR
Hi Scott,

according to XHTML 1.0 Strict / 1.1 specification we should serve XHTML pages as XML documents (rather than text ones) with corresponding MIME type (say text/xml).

Since you mentioned S.Walter's article here (and since I didn't get any reply in asp.net forums <g> on my problem) I throw it here.
S.Walther shows some ways of how to handle XHTML1.0 strict pages and get around some IE limiting issues with MIME types in his article, but every time I tried the 1st workaround it failed (content negotiation does work).
http://msdn.microsoft.com/asp.net/reference/design/default.aspx?pull=/library/en-us/dnaspp/html/aspnetusstan.asp#aspnetusstan_topic8

Simply, I am not able to do XSL transformation of XML document to HTML, running pages on IIS or local web server and browsing via IE. Even tried exact copy and paste of SW's code sample w/o experimenting with it at all.

waiting for your 'Hope it helps' =)
thank you

# re: XHTML Validation Module Checker for ASP.NET 2.0

Monday, April 10, 2006 4:49 PM by cowgaR
great module! Works for IE =)

I have been using this (as a Firefox preacher):
https://addons.mozilla.org/firefox/249/

great w/ combination of webdev toolbar.

# re: XHTML Validation Module Checker for ASP.NET 2.0

Wednesday, April 12, 2006 4:18 AM by dwd
Great module, but it appears to be showing lots of ASP.NET 2.0 bugs with XHTML Strict!!! Am I doing something wrong? (These may not all ne ASP.NET's fault, but I suspect most are :-)

Examples include:
* .ascx controls render as <div name="ctl....", when name is not an allowed attribute.
* some script refs render as <script src="AppName/WebResource.axd?d=...&t=..." which should be uncoded as ...&amp;t=...
Interestingly some are encoded in the form <script src=... type=...> but the one <script type=... src=...> are not!
* <script> blocks without a type attribute
* <script type="text/xml-script><page ...> where page is not an allowed element

I have set <xhtmlConformance mode="Strict" /> in web.config, but no joy. Any other suggestions

# re: XHTML Validation Module Checker for ASP.NET 2.0

Thursday, April 13, 2006 1:48 AM by scottgu
Hi Dwd,

I think some of the issues you mentioned above are actually app-specific as opposed to ASP.NET framework issues. For example, user controls don't render any <div> elements -- so I think the <div name=""/> issue is related to the implementation of a server control possibly.

Hope this helps,

Scott

# re: XHTML Validation Module Checker for ASP.NET 2.0

Friday, April 14, 2006 6:46 AM by dwd
You are right about some, I have tracked them to 3rd party controls. But the <script type="text/xml-script> is the atlas:ScriptManager and the script with a missing type is the TreeView, it wraps "TreeView_PopulateNodeDoCallBack".

# re: XHTML Validation Module Checker for ASP.NET 2.0

Wednesday, May 03, 2006 3:10 AM by Josh
Hi,
what is the difference between the default Validation check for XHTML in Visual Studio2005 and your Validation Module Checker for ASP.NET2.0.
Please clarify me.

Thanks & Regards
Anbarasu


# re: XHTML Validation Module Checker for ASP.NET 2.0

Wednesday, May 03, 2006 5:59 AM by scottgu
Hi Anbarasu,

The XHTML validator in VS does source level validation on the .aspx markup prior to it being rendered. This provides a good approximation for whether it is valid or not, and is very useful in development (when you might not yet have a runnable app).

The XHTML module I listed above actually analyzes the generated output of the application. And so is always accurate as to whether it is XHTML compliant.

Hope this helps,

Scott

# re: XHTML Validation Module Checker for ASP.NET 2.0

Friday, May 05, 2006 7:48 AM by C.Anbarasu
I am planning to use this XHTML Validation Module Checker for ASP.NET 2.0 in my project. It would be helpful ,if you clarify the following
1.Please tell me the advantages of using this module
2.Is this helpful during development or Testing .

Thanks
Anbarasu

# re: XHTML Validation Module Checker for ASP.NET 2.0

Friday, May 05, 2006 8:12 AM by scottgu
Hi Anbarasu,

These are good questions. I'd recommend asking them though on the Validation Module Checker's site -- since they'd probably be the best people to answer them. My sense is that you'd want to use this during both development and testing.

Hope this helps,

Scott

# re: XHTML Validation Module Checker for ASP.NET 2.0

Saturday, May 06, 2006 3:13 AM by C.Anbarasu
Hi,
Thanks for your reply.

How to generate the report at the top of Page's Output when the output mode is "HTML"

Thanks,
Anbarasu

# re: XHTML Validation Module Checker for ASP.NET 2.0

Thursday, June 08, 2006 2:51 PM by Jørn Schou-Rode
Anbarasu > Take a look at this:
http://www.thejoyofcode.com/Extending_the_Validator_Module.aspx
" HtmlFloat (displays a floating report at the top of the page)
<validatorModule mode="HtmlFloat" ... > "