Saturday, August 16, 2008

Resolving W3C Validation Issues


For those who are wondering why should one bother with W3C Validations,
please read Why should we Validate our WebSites?

When validating your website using W3C some weird errors might occur

An Example is


there is no attribute "border"



even if you haven't given the border attribute

The Reason


The ASP.NET engines sees the W3C validator as down-level browser and renders
non-XHTML compliant code. Your code is most likely fine. The problem is with
ASP.NET.




The Solution(Step Wise)


1.Right Click on your Solution Explorer
2.Click on Add ASP.NET Folder ---> App_Browsers
3.Now Click on App_Browsers ---> Add New Item
4.A dialog Box now pops up with some Visual Studio Installed Templates.
Select the Browser File Template from there, change the name as W3CValidations.browser(any other convenient name also) and Click on the Add Button
5.Delete the whole XML MarkUp code inside the W3CValidations.browser
6.Place the following code instead



<browsers>
<!--
Browser capability file for the w3c validator

sample UA: "W3C_Validator/1.305.2.148 libwww-perl/5.803"
-->
<browser id="w3cValidator" parentID="default">
<identification>
<userAgent match="^W3C_Validator" />
</identification>

<capture>
<userAgent match="^W3C_Validator/(?'version'(?'major'\d+)(?'minor'\.\d+)\w*).*" />
</capture>

<capabilities>
<capability name="browser" value="w3cValidator" />
<capability name="majorversion" value="${major}" />
<capability name="minorversion" value="${minor}" />
<capability name="version" value="${version}" />
<capability name="w3cdomversion" value="1.0" />
<capability name="xml" value="true" />
<capability name="tagWriter" value="System.Web.UI.HtmlTextWriter" />
</capabilities>
</browser>
</browsers>



7.Now upload this Folder and File to your Hosting Service
8.Re Validate using W3C Validator
9.Bingo! You got a Clean Validation Certificate.
10. Show off the Validation Certificate to all those who cares [:)]

Courtesy

Link at DigitalColony.com

Link at idunno.org


Happy Coding!

Related Posts :



1 comments on "Resolving W3C Validation Issues"

Add your comment. Please don't spam!
Subscribe in a Reader
Anonymous said...

this is very helpful and attractive biog.
visit for asp.net help asp.net help

Post a Comment