If you’ve ever created an XHTML 1.0 Strict page containing an ASP.NET form
element and ran it through the W3 Validator, you’ve undoubtedly noticed it’s reported as being invalid no matter what you do and no matter how valid the code actually appears. This is because ASP.NET adjusts the way it renders markup according to the requesting user agent. ASP.NET pities the W3 Validator and sends it bad code. This can be fixed with a “browser” file. The file and instructions on its use are available from that page.
However, that’s not all. The validator will now see your pages the way you see them in your browser, but ASP.NET is still rendering an invalid name
attribute on your form
element! You need to add a line to the system.web
section of your web.config file:
<xhtmlConformance mode="Strict" />
Now ASP.NET plays nice with the W3 Validator and renders a valid XHTML Strict form
! Now you can stop using the XHTML Transitional doctype and start using the XHTML Strict doctype on your ASP.NET pages!