Let's begin with an example of simple asp.net code:
<asp:ImageButton ID="_imgBtn" runat="server" ImageUrl="~/images/Img.jpg" Height="50px"
Width="50px" BorderWidth="0px" BorderStyle="None" />
That's a valid asp.net code and it works fine, BUT when you try to validate it
through W3C (http://validator.w3.org/) you will see error like this:
Error Line X column X : there is no attribute "border".
This is a problem caused by W3C running validation whilst reading the HTML rendered for a simple browser like Netscape !
Do you want your pages to be valid for old-fashioned browsers which nobody uses anymore?
If the answer of last question is 'No' here's a solution:
Add a BrowserFile.browser file with the content below inside an App_Browsers folder in the app's root. The section for validation tells it
to use the same code as IE 7 or Firefox will. Add this and your page should validate:
<!--
You can find existing browser definitions at
<windir>\Microsoft.NET\Framework\<ver>\CONFIG\Browsers
-->
<browsers>
<browser id="NewBrowser" parentID="Mozilla">
<identification>
<userAgent match="Unique User Agent Regular Expression" />
</identification>
<capture>
<userAgent match="NewBrowser (?'version'\d+\.\d+)" />
</capture>
<capabilities>
<capability name="browser" value="My New Browser" />
<capability name="version" value="${version}" />
</capabilities>
</browser>
<browser refID="Mozilla">
<capabilities>
<capability name="xml" value="true" />
</capabilities>
</browser>
<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>
That's All :) Happy Coding :)