Geeks With Blogs

News
Employers
Soppa Group India
iSmart Panache Inc
R Systems Internationals Ltd
Technovate eSolutions Pvt Ltd
The contents of this blog are my personal opinion and do not represent in any way the view of my employer.
These postings are provided "AS IS" with no warranties, and confer no rights.

Google PR™ - Post your Page Rank with MyGooglePageRank.com

Narendra Tiwari

Web pages that are conformant with XHTML standards has several advantages:

>> It guarantees that the elements in the pages are well formed.

>> Because many browsers are increasingly moving toward supporting XHTML, creating pages that conform to XHTML standards helps ensure that your pages render consistently in all browsers.

>> Using XHTML helps to make pages conform more readily to accessibility standards.

>> XHTML is extensible, allowing the definition of new elements.

>> An XHTML page is much easier to read programmatically for situations in which the Web page is processed by a computer instead of being read by users, and the document can be manipulated using transformations.

The W3C has identified several levels of XHTML conformance:

XHTML 1.0 Transitional,
XHTML 1.0 Frameset,
XHTML 1.0 Strict,
XHTML 1.1.

The XHTML 1.1 specification is the strictest of these levels.

Controlling XHTML Rendering of ASP.NET Pages and Controls
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)

Checking XHTML Conformance of ASP.NET Web Pages:- W3C Markup Validation Service

You can configure your application to send the correct XHTML-conformant markup to the validation service by creating a browser definition for the validation service's user agent string. For example, the W3C Markup Validation Service reports a user agent that begins with "W3C_Validator". To create a browser definition for the W3C validator, you can create a .browser file in your application's App_Browsers folder (you can name the .browsers file anything you like) and then add the following browsers element.

<BROWSERS>
  <BROWSER id=W3C_Validator parentID="default">
    <IDENTIFICATION>
        <USERAGENT match="^W3C_Validator" />
    </IDENTIFICATION>
    <CAPABILITIES>
      <CAPABILITY name="browser" value="W3C Validator" />
      <CAPABILITY name="ecmaScriptVersion" value="1.2" />
      <CAPABILITY name="javascript" value="true" />
      <CAPABILITY name="supportsCss" value="true" />
      <CAPABILITY name="tables" value="true" />
      <CAPABILITY name="tagWriter" value="System.Web.UI.HtmlTextWriter" />
      <CAPABILITY name="w3cdomversion" value="1.0" />
    </CAPABILITIES>
  </BROWSER>
</BROWSERS>

Configure XHTML rendering in an ASP.NET Web site

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
Building ASP.NET 2.0 Web Sites Using Web Standards
http://www.thejoyofcode.com/Validator_Module.aspx
Posted on Thursday, May 25, 2006 2:41 PM .Net | Back to top


Comments on this post: ASP.Net And XHTML

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Narendra Tiwari | Powered by: GeeksWithBlogs.net