Home > Tutorials > .NET > Getting ASP.NET to Output Strict Markup

Getting ASP.NET to Output Strict Markup

By default, ASP.NET is configured to produce markup according to the Transitional conformance of XHTML. If you're like me, you'll want all of your pages to be valid XHTML Strict 1.0. Doing this is very easy. The only thing you have to do is add one line to your system.web section of your web.config file.

  • <system.web>
  • <xhtmlConformance mode="Strict" />
  • </system.web>

As you can see, I added the xhtmlConformance element with the mode attribute set to Strict. This forces ASP.NET to output valid Strict markup for all of the standard web controls.