If you would like to hire my services, you can now do so by visiting the following link:
Website Design Darlington
Article Statistics
Code Bank Statistics
Summary: ASP.NET 2.0 has problems when trying to validate a XHTML 1.0 Strict page using the W3 validation service.
If you are using an XHTML Strict DOCTYPE e.g. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Then you might notice that your ASP.NET pages don't validate correctly when using the W3 validator service. This is because when the request comes in from the service, ASP.NET treats the service as a down level browser and the HTML that is generated doesn't comply to the standard that the DOCTYPE needs. If you view the page from a browser and then sent the generated HTML, it would validate but this doesn't help with direct requests from the w3 service.To get around this problem, you need to create an ASP.NET folder in your project called "App_Browsers". Then, inside that folder create a file named"w3cvalidator.browser" and add the following code: <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> Now, when the w3 service requests your page, it won't be treated as a low level browser and the correct HTML will be rendered so that your page will validate (assuming you haven't made any errors!).
Posted on 02/03/2007 02:56:54
1. Grant 01/06/2007 13:13:07
But how do you get ASP.NET 2.0 to write valid XHTML 1.0 Strict to start with? Also, I seem to get warnings like this:line 49 column 1 - Warning: <input> ID "__EVENTTARGET" uses XML ID syntaxline 50 column 1 - Warning: <input> ID "__EVENTARGUMENT" uses XML ID syntaxline 51 column 1 - Warning: <input> ID "__VIEWSTATE" uses XML ID syntaxline 265 column 2 - Warning: <input> ID "__EVENTVALIDATION" uses XML ID syntaxand I am wondering if there is anything I can do to make it so I don't get these warnings? Would the solution you pose above resolve this?
2. Mark Smith 02/06/2007 03:11:03
Grant,What DOCTYPE are you using? Can you provide a link to your page?Thanks,Mark
Please keep your comments relevant to this page. Any inappropriate or purely promotional comments may be removed. Email addresses are never displayed but are required so you can confirm your comments.