No XHTML 1.0 Strict in ASP.NET 2.0

The improved support for web standards in Internet Explorer 7 and ASP.NET 2.0 could make you believe that the people at Microsoft are finally catching up with the rest of the web. But are they really? They sure don’t seem to know the difference between XHTML 1.0 and 1.1, and they seem to think that Transitional DOCTYPEs are the default.

In ASP.NET and XHTML, Milan Negovan notes that the XHTML 1.0 Strict DOCTYPE is missing from Visual Studio 2005. Very odd, and very unfortunate. Milan has more to say about the DOCTYPEs that are available in Visual Studio 2005 in That Pesky Document Schema Picker: Part II.

I guess this means that we will continue to see clueless ASP.NET developers produce sites with an XHTML 1.1 DOCTYPE and a mix of HTML 4.01 and XHTML 1.0 markup. Transitional, of course.

Update: Ok, I obviously touched a nerve there. Sorry, I did not mean this as a flamebait, and I should have made it clear right from the title of this post that this isn’t really about ASP.NET. It’s about Visual Studio.

Visual Studio does not equal ASP.NET. I know that. You know that. And yes, it is possible to create your own controls that output perfectly valid and accessible HTML. But how many developers do that? Very few. That’s why improving the default is important.

Posted on November 30, 2005 in (X)HTML, Quicklinks, Web Standards

Comments

  1. I guess this means that we will continue to see clueless ASP.NET developers produce sites with an XHTML 1.1 DOCTYPE and a mix of HTML 4.01 and XHTML 1.0 markup. Transitional, of course.

    Yep, that is true. But Microsoft is really trying to improve on the web standards front and from now on it can possibly only be better. Visual Studio even don’t create (very) messy code any more..!

    I think Microsoft are kind of doing the same thing as developers using XHTML 1.1 serving it as text/html instead of the correct mime type.

  2. I guess this means that we will continue to see clueless ASP.NET developers produce sites with an XHTML 1.1 DOCTYPE and a mix of HTML 4.01 and XHTML 1.0 markup. Transitional, of course.

    So explain to me how this would be any different if Visual Studio included support for the strict doctype? Using ASP.NET does not preclude one from having to write any HTML at all. A clueless developer may select the strict DOCTYPE if it was available to him, but he’d still write crappy HTML. He’d get the little red squiggly, for sure… but he’ll just ignore it, as he did in Visual Studio.NET 2003 and Visual Studio.NET 2002!

    Developers who care about standards have options. They can use the strict doctype themselves. They can rely on third party controls if need be.

    In short, nothing to see here…

  3. “I guess this means that we will continue to see clueless ASP.NET developers produce sites with an XHTML 1.1 DOCTYPE and a mix of HTML 4.01 and XHTML 1.0 markup. Transitional, of course.”

    As will we see all other clueless programmers/webdevelopers (that uses any other technology to produce both static and dynamoc webpages) continue to produce sites with invalid html markup.

    Note that the link you provided to aspnetressources states

    “For the curious kind, all these schemas are located in Program Files\Microsoft Visual Studio 8\Common 7\Packages\Schemas\html. I’ve poked around a couple of them and realized that adding the missing ones would be very time consuming.”

    Even though the assumption is that it will be an timeconsuming task to include more schemes it will probably be done.

    I did a few tests with vs2005 , it were no problem at all to let them (although simple) validate xhtml 1.1 strict with very few modifications, the problem with vs2002/3 where that the IDE messed with your html markup, when shifting from the different views, this does not happen in vs2005.

    It’s clueless that the VS2005 doesn’t produce valid markup, but I would still prefer it over any IDE anytime, I have toyed with a lot of them over the time - but the VS2005 (and .net 2.0) is by far the best and easiest to work with in both the model,control and view layers and the integration in between, even though I need to adjust some of the markup in the viewlayer (when it comes to asp.net applications).

  4. November 30, 2005 by Roger Johansson (Author comment)

    Hey now, I’m not saying all ASP.NET developers are clueless - I know there’s a whole bunch of you that are fully web standards enabled :-).

    Yes, other DOCTYPEs can be added. But why didn’t Microsoft add those that are the current best practice? They’re trying, but come on, a company like Microsoft should be able to find someone who knows the difference between different versions of HTML and XHTML, right?

    So explain to me how this would be any different if Visual Studio included support for the strict doctype? Using ASP.NET does not preclude one from having to write any HTML at all.

    If VS was set to choose a Strict DOCTYPE by default and the controls that come with it only produced valid Strict HTML or XHTML, there would be a lot less messy markup on the web. Like it or not, many ASP.NET developers just don’t care about HTML.

  5. So far, I work only in .NET when doing the logic behind the scenes, I really like C# as a language that’s probably why.

    I would say that though 2.0 is a step up in some ways, Microsoft (as always) seems to be one step behind. The built in webcontrols may make it easier (read:faster) for some people to develop, but the result is often a unmodern mark-up mess. The thing is, as long as there are fast ways to do things many will cluelessly (is that a real word?) use those ways, as Roger says.
    Imagine the impact it would have on developers if Microsoft would focus their developer tools on semantics, accessiblity and usability.

    (There is a tag in web.config that makes the built-in controls get rid of arguments that isn’t valid XHTML strict, but I guess you already now that.)

  6. “Like it or not, many ASP.NET developers just don’t care about HTML.”

    Like it or not, many developers just don’t care about standards of any kind.

  7. November 30, 2005 by Roger Johansson (Author comment)

    Hehe, I guess you’re right about that, Kasper :-).

  8. Its really not the problem of ASP.NET. Everything is on the developer. You can do HTML/XHTML Strict/Transitional its only up to you if you use the build in controls that save time and generate messy output or create you own to follow the rules. I personally don`t care if you can not choose XMTML 1.0 Strict from some drop down menu in Visual Studio. The knowlege of succesfuly using it goes far beyond that.

  9. November 30, 2005 by Roger Johansson (Author comment)

    Bjarne:

    There is a tag in web.config that makes the built-in controls get rid of arguments that isn’t valid XHTML strict, but I guess you already now that.

    Nope, never heard of that actually. Where can I find more info on that setting?

  10. I couldn’t agree more. Defaults, are very important…especially for tools that’ll be used by people who don’t generally know how to code decent or care to code decent.

  11. November 30, 2005 by Shannon Cornish

    You can add the following to your web.config to get ASP.NET to generate valid XHTML strict tags.

    <xhtmlConformance mode=”Strict” />

    I think the change was between beta 2 and RTM that they moved from strict being the default to transitional. The reason was they wanted to support asp.net 1.1 sites using the asp.net 2.0 framework, where developers had client side code that contained

    document.formname

  12. November 30, 2005 by Shannon Cornish

    Ok, that didn’t work. Here is a link to the MSDN documentation: xhtmlConformance Element

  13. November 30, 2005 by Roger Johansson (Author comment)

    Shannon: Thanks. That’s very interesting. I updated your comments to make the xhtmlConformance Element visible and made the URL a live link. The documentation page doesn’t work properly in Safari (no scrollbars, and the scrollwheel doesn’t work - never seen that one before), but at least I could get to some of the info.

  14. The flamebait was not that you mixed up the concepts of vs2005 and asp.net it’s ok and I only commented on the visual studio part her (and posted the aspnet/vs2005 as a correction on my weblog.)

    The flamebait part is the one where you put most (but a “Very few”) .net developers under one hat and say that they dont care about valid html and accessibility - and let me assume that it’s a particular issue with .net developers.

    My experience is that following standards does not have anything to do with which platform you work on.

    When it comes to defaults and drag’n’drop - I doubt that it’s so widespread as you assume, but you are right when jumping on vs for making it more difficult than it needs to be to produce standard compliant html.

  15. November 30, 2005 by Roger Johansson (Author comment)

    Kasper: Again, sorry about that. I’ve had a lot of bad experiences with .net developers. Judging from that, those who - like you - care about the markup their applications output are a minority. But I could be wrong.

  16. But I could be wrong

    I’m afraid you aren’t - but I think it’s a general developer issue. I don’t know many java developers who care about standards either or even “web designers” or even “interface developers”…

    When it comes to defaults and drag’n’drop - I doubt that it’s so widespread as you assume

    I think it’s even more widespread, and Microsoft promotes this use throughout videos, seminars og documentation. So it only goes one way. This is why it’s really important to do the lobby work like Roger and the rest of the accessibility organisations does!

    /n

  17. I don’t think you are wrong but its an overall issue (an issue we probably all, some more than other, have been a part of) - and thats why it’s so kool that guys like yourself stand to correct it.

  18. While I agree that it’s not that good that it isn’t amongst the default options, it’s easily doable by changing something in Web.config (as Bjarne pointed out).

    Like this:

    
    
        
    
    

    It’s described in Building ASP.NET 2.0 Web Sites Using Web Standards.

    (Crossing my fingers that the comment preview and actual display of the comment will be the same)

  19. While I agree that it’s not that good that it isn’t amongst the default options, it’s easily doable by changing something in Web.config (as Bjarne pointed out).

    Like this:

    
    <system.web>
        <xhtmlConformance 
            mode="strict" />
    </system.web>
    

    It’s described in Building ASP.NET 2.0 Web Sites Using Web Standards.

    (Crossing my fingers that the comment preview and actual display of the comment will be the same)

  20. it is possible to create your own controls that output perfectly valid and accessible HTML. But how many developers do that? Very few. That’s why improving the default is important.

    Totally. Visual Studio.NET purports to make it unnecessary for, say, C# developers to worry about writing HTML or CSS.

    Despite being an HTML/CSS developer, I’m fine with that, but as long as Visual Studio.NET has the stock controls, they will be used, a lot. For the good of all of us, they need to be valid and accessible.

  21. It’s sad but I have to agree with Roger that ALL .net developers I have worked with don’t have a clue in delivering good markup or going the extra mile to do so. And I have this from first hand experience so it isn’t a global observation.

    There aren’t many people in .net world like Kasper. In all my dealings with developers I only know 1 company who cares and then it is only 1 developer in a larger group.

  22. December 17, 2005 by Keith J

    Although I agree most developers (.NET & others) do not worry about following the latest W3C standards, I feel up to this point in internet development there were too many “standards” to follow. Every browser company would create new syntax when ever they wanted a little more control. These new W3C web standards are in their infancy (and this is the real problem!) and like anything new it takes time to get everyone on board. Besides, all existing browsers handle badly written html so why bother writing the good stuff. Plus you have a hell of a lot of web pages that need to be brought up to date.

    I personally try to stay on top of and follow all standards for any development I do, and yes I am a .NET developer. But it will take time for these new standards to take root and then everyone every where will have to follow them as, I would hope, the newer browsers will not display badly written html. But until then most people just want to get their code finished and running, if it displays properly then great, job done. Time is money after all (not my personally philosophy but one many companies follow).

    My only point beyond this is that I have seen more than just ASP.NET developers who do not follow the new standards so I would not just single them out as I have seen some people doing. But I agree Visual Studio and the ASP.NET serving engine need to be on top of this. However I do not believe development tools will be 100% standard compliant until the browsers are!

  23. Here is my take on asp-developers who visit this blog: They (you) are Standards-aware, otherwise you wouldn’t be here ;-)

    But there is a gazillion asp-sites on the net that from a markup point of view really, really suck! Roger is a Swede, like myself, and even though there are excellent guidelines for Swedish public websites available and they are supposed to be followed, most big companies seem not to care.

    Recently I surveyed the three leading systems for web-based information management for schools in Sweden - all three built i asp. None passed even the simplest tests. The leading vendor’s solution was abysmal from a markup POV. Their technical salesmen told me standards and accessibility are not “demanded by the customers”, to which I retorted “don’t you have any professional pride?” and when they passed the questions on to the developers they did not seem to know what I was talking about.

  24. January 11, 2006 by Liming

    I’m a Java developer by day and .NET developer by night and honestly? If I have not worked with designers closely, then I wouldn’t have cared about it as I’m now either.

    JSP doesn’t delievery compliant code out of the box either, I see many open source Java projects don’t genereate complaint code, so do the most of the Java IDEs. In fact, let me know a platform that genereates compliant code by default.

    I get compalints from designers a lot when my Java or .NET code mess up their code. But what can I do? The control I used itself doesn’t genereate complaint code and it gets my job done. With deadlines coming up, making it complaint is the last thing that comes in my mind. Thought, we’ve been trying hard to match the code output to what the designers designed, in reality, sometimes it’s just not happening. The world is not perfect, improvements take time.

  25. January 12, 2006 by Roger Johansson (Author comment)

    Liming: It is very unfortunate that many IDEs, be they .NET or Java, are created by people who don’t know HTML, despite that being what their product outputs. I’m sure many developers find themselves in your situation, and it’s understandable that you feel there is nothing you can do. But just blaming the tools and knowingly produce websites that likely won’t work properly for all of your visitors is in my opinion not the way forward.

    What I think you should do, if fixing the IDE or control is not an option, is avoid using it if possible and complain to the people who made the IDE. They need to be made aware of the problems and learn HTML.

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.