How to: Configure XHTML Rendering in ASP.NET Web Sites
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
By default, when you are working with browsers that support at least HTML 4.0, ASP.NET pages and controls render markup that conforms to the XHTML 1.0 Transitional standard. However, you might want ASP.NET to render markup that conforms to the stricter XHTML 1.0 Strict specification. Conversely, you might want ASP.NET to render markup that does not conform to XHTML 1.0 Transitional specifications. This is typically true when you have existing pages that rely on tags or attributes that were supported in earlier versions of ASP.NET but do not conform to XHTML standards, such as rendering a name attribute in the form tag.
You can configure your Web site to render markup in three ways:
Legacy (which is similar to how markup was rendered in previous versions of ASP.NET)
Transitional (XHTML 1.0 Transitional)
Strict (XHTML 1.0 Strict)
For details, see ASP.NET and XHTML.
To configure XHTML rendering in an ASP.NET Web site
Under the system.web element in your application's Web.config file, add an xhtmlConformance element, and then set the mode attribute to Legacy, Transitional, or Strict. If no xhtmlConformance element is defined in the Web.config file, the default setting mode is transitional.
The following code example shows part of a Web.config file in which XHTML rendering is disabled.
<system.web> <!-- other elements here --> <xhtmlConformance mode="Legacy" /> </system.web>
The following code example shows part of a Web.config file in which XHTML 1.0 Strict rendering is specified.
<system.web> <!-- other elements here --> <xhtmlConformance mode="Strict" /> </system.web>