Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Web Pages
Web Page Designer
Learning More
ASP.NET and XHTML
 How to: Configure XHTML Rendering i...
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:

Want more? Here are some additional resources on this topic:

ASP.NET 
How to: Configure XHTML Rendering in ASP.NET Web Sites 

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>

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker