XHTML and Accessibility Standards in ASP.NET 2.0 and VS 2005

Stephen Walther has written a great MSDN article on XHTML and Accessibility Standards in ASP.NET 2.0 and VS 2005 that has just been published: http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/aspnetusstan.asp

The final release of ASP.NET 2.0 now emits XHTML 1.0 Transitional content by default, and VS 2005 also now defaults to validating content markup and providing intellisense/statement completion for both HTML and Javascript using an XHTML 1.0 Transitional schema.

With the Beta2 release, we defaulted to emiting XHTML strict markup but found that it impacted a lot of customer applications with Javascript that depended on the "name" attribute of the <form> tag (for example: script that references elements like "myform.textbox1").  The name attribute is legal in XHTML Transitional, but not allowed in strict, so when we omitted it from rendering with the <form runat=server> tag to be strict we found that a lot of customer applications broke.  This is why we ultimately decided to change the default to be XHTML Transitional for the final release.

The good news is that if you do want XHTML strict output, you can still get it with the final release.  Just change the new "xhtmlConformance" tag in your web.config file and then ASP.NET will omit markup that complies with the strict standard:

<configuration>

    <system.web>

        <!--
            <xhtmlConformance mode = "Transitional" [Transitional | Legacy | Strict] />
        -->
        <xhtmlConformance mode="Strict" />

    </system.web>

</configuration>

Note that in addition to changing the runtime behavior to be strict, you can also then change the validation drop-down in the VS toolbar to validate html/javascript against XHTML strict as well.

One area where we are still planning to invest a lot more post-Whidbey is with CSS support in both Visual Studio and ASP.NET (with Whidbey we are 100% XHTML standards compliant from a markup perspective, but don't leverage CSS as much as we could).  You'll see some of the cool things we are doing with CSS in the new Atlas-based server controls we are releasing in tech-preview form the week of PDC (less than 2 weeks from now), as well as with the preview of the new Visual Web Developer Orcas Edition we are showing in one of the breakout sessions. 

 

13 Comments

  • This is fantastic news Scott. I will be attending PDC and would like to get more information on Atlas while I am there - I am currently using asp.net 1.1 and have written a AJAX/callback API for the current project I am on.



    Speaking of PDC and this news - are there going to be any sessions dedicated to discussing Atlas? Please let me know if so!

  • Some improvements have been made to follow the standards. There are a lot of problems, especially with XHTML output. Microsoft should look at Sitecore (www.sitecore.net) see the how they have achieved it - their technolgy is based on .NET. I can MS losing CMS market in Europe because of their lack of interest.

  • I feel that it will useful to use strict html but for today i need transitional xhtml for working javascripts on client side to make connection identificators of asp.net controls with procedures written by javascripts. And i wondering how you will do the atlas with strict xhtml or you are going also use the t/xhtml still?

  • What is Visual Web Developer Orcas Edition? Whidbey is not even released yet, not even the release candidate, and already you are ready to preview Orcas?

  • Hi LukCAD,



    We will support both strict and transitional with Atlas. Note that all ASP.NET controls support strict today -- the only issue is that a lot of customers rely on non-strict supported features which is why we couldn't make it the default.



    Hope this helps,



    Scott

  • Hi Steve,



    We are having two sessions on Atlas at the PDC this year (I'll also be demoing Atlas in one of the keynote presentations the first day). I'd definitely recommend attending the Atlas sessions and playing with the tech preview -- there will be some cool stuff in it. :-)



    Thanks,



    Scott

  • Hi Klaus,



    We've had some advance teams working on Orcas for awhile now, and some of the things you'll be hearing about at the PDC (Atlas, our new Workflow/Pageflow features, and Visual Web Developer Orcas) will be the result of this work. We won't be giving our Visual Web Developer Orcas bits at this year's PDC -- but we will be showing a sneak peak demo of it in one of the sessions.



    Hope this helps,



    Scott

  • Thats good news but will it output Tables for layout? rather than divs or some semantic tags?

  • Hi David,



    A lot of controls still output tables with V2.0, although templated controls can be easily configured to output divs.



    The atlas based server controls all output divs and rely on CSS for positioning.



    Hope this helps,



    Scott

  • It does help a little although I will be over the moon when they all do this by default (unneeded divs aren't great but better than tables) As a lot of people will use the controls &quot;out of the box&quot; it would be great to tidy up the web a little without much effort ;)

  • Hi Ben,

    Those html elements are generated as ones, and they only have the name attribute set. As such, they are still legal XHTML.

    Hope this helps,

    Scott

  • We are running into accessilbilty issues because the IDs for the following are invalid:

    __EVENTTARGET __EVENTARGUMENT __VIEWSTATE __EVENTVALIDATION


    AspNet2 is generating both name and id tags, is there a way around this?

    We have to validate against the sitemorse tool and this fails the above IDs on code quailty and accessibilty.

  • Hi Paul,

    Can you send me an email on this issue? I will then loop some folks in from the team to help.

    Thanks,

    Scott

Comments have been disabled for this content.