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.
В Copy Code
<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.
В Copy Code
<system.web> <!-- other elements here --> <xhtmlConformance mode="strict" /> </system.web>