jeffamm Posted December 13, 2006 Share Posted December 13, 2006 I'm working on getting the main pages of my website to validate, but keep getting an error in one line of code that is created dynamically by asp.net pages. If you load the page with an older browser it delivers code with older-compatible html. If you load it with a new browser, you get more recent and valid (by W3C standards) html/xhtml. The validator "browser" type must be or appear "old" in that it is getting the non-valid code. Is there any way to tell the validator to view the site with a more advanced browser? I apologize if my language isn't completely precise but hopefully you understand the issue and question.many thanksJeff Link to comment Share on other sites More sharing options...
jesh Posted December 13, 2006 Share Posted December 13, 2006 Since this is .NET, you might consider playing around with the browserCaps setting in the Web.Config file.This Google search may help: http://www.google.com/search?hl=en&q=b...s+W3C_Validator Link to comment Share on other sites More sharing options...
jeffamm Posted December 16, 2006 Author Share Posted December 16, 2006 Thanks for your help jesh - the browser caps search led me to Phil Scott's Weblog where I found the item below. I created a browser caps section in my web.config and added the code below, and it cleared up the error I was getting due to rendering for different browsers. I was still left with one rendering error, which I'm posting in this forum separately, but was able to work-around it be deleting it. Crude, but it validates, and appears to have no other effect on my site. thanks again,Jeff"With the go-live of ASP.NET 2.0, I've been actually using it at a level of more than "ooh, pretty new feature." I'm kinda of a standards nerd, so naturally I've been messing around with the XHTML output and making sure I like what I'm seeing. So far, so good. But I ran my page against the W3C's validator and it freaked out, complaining about form tags having names and the such. So I take a look at the source, and it looks good to me. So I go back to the validator, and run it one more time, this time enabling "Show Source." Ah, there's the problem. ASP.NET thinks that the validator is some ghetto browser from 1996 so it is sending it invalid markup.The fix was pretty easy once I tracked it down. Simply update the browseCaps section of your web.config to tell ASP.NET about the W3C's user-agent. Here's the code I'm using:<case match="W3C_Validator+"> browser=Netscape frames=true tables=true cookies=true javascript=true javaapplets=true ecmascriptversion=1.5 w3cdomversion=1.0 css1=true css2=true xml=true tagwriter=System.Web.UI.HtmlTextWriter</case>Now when you validate your page, ASP.NET will send out the same HTML as it would if Firefox or IE were requesting the page. Now what I'd really like to do is tell ASP.NET to shove it, and spit out XHTML on unknown browsers. Anyone have any ideas?" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now