Skip navigation.

Page Events Raised TwiceAll recent postsTypes of Business People In Technology

ASP.NET and XHTML

An MSDN article ASP.NET and XHTML talks about conformance of server controls with XHTML, markup validation, changes to rendering logic between HTML and XHTML, changing page MIME type, and other interesting points.

One thing that I still can’t make peace with is that markup can be rendered in one of three modes:

  • Legacy (which is similar to how markup was rendered in previous versions of ASP.NET)
  • Transitional (XHTML 1.0 Transitional)
  • Strict (XHTML 1.1)

This brings me to the same point: where do HTML 4.01 Strict, HTML 4.01 Transitional and XHTML 1.0 Strict fit in?

Obviously, what DOCTYPE is declared in markup is of little meaning to server controls, and I assume they rely on the <xhtmlConformance> section to figure out how to render themselves. If I configure XHTML conformance to a strict mode, which xxxxx Strict am I getting? In other words, I want HTML 4.01 Strict, will the output be coerced to XHML 1.1 Strict? That’d be wild!

I guess I need to put together some test cases and see for myself. So far I just don’t get it.

Comments

Comment permalink 1 Chris Lienert |
I held out hope that doctype target rendering would be good in v2 and, like you, I'm greatly disappointed with the limited options available.

I guess I'll have to continue with custom control rendering...
Comment permalink 2 scottgu |
The actual rendered is up to the developer (ASP.NET doesn't control this -- it is specified in the .aspx page and can be set to whatever the developer wants).

ASP.NET 2.0 controls do then render in one of three markup output modes:

Legacy
XHTML Transitional
XHTML Strict

You can configure which ones you want and it will restrict itself to outputing the default controls in that markup format.

I believe you should be able to set an HTML 4.01 strict doctype, and then configure the controls to render to an XHTML Transitional (or strict) sub-set and still be HTML 4.01 valid and compliant.

Hope this helps,

Scott
Comment permalink 3 Stefan |
The output code is valid if you use however ASP.NET output code is browser dependant and it does not recognize w3cvalidator and that's why it doesn't validate. There is however a way to get valid output and validate with w3c without using compilance filters. You simply create a folder called "App_Browsers" and put a file called "w3cvalidator.browser" into it containing the following code:
























Now ASP.NET recognizes the validation-engine and your page validates. There's nothing more to it. I still hope Microsoft takes care of this with a future update so that no extra code or files are nessesary to get valid output. For now I think this is the best solution to get valid output easily without effecting the site performance.
Comment permalink 4 inoodle |
From my (brief, slightly drunken:) tests, its seems like html 4.01 strict isn't an option. The problem being the id names being __EVENT... etc.
Surely this can't be right though... I'll stagger on a bit more...:)
Comment permalink 5 Shannon J Hagere |
My guess:
I use xhtml 1.0 transitional because I simply can't use strict. If I were able to use strict, I would hopefully use 1.1 strict. And "legacy" sums up all the people still using old calendars... ;)

Just a guess, but the 3 choices make sense to me.

Emails and Notifications

Would you like to be notified when somebody responds to this post?  Would you like to have these comments emailed to you?

TrackBacks

1 456 Berea Street  |   
No XHTML 1.0 Strict in ASP.NET 2.0

Microsoft still has some catching up to do when it comes to understanding Strict DOCTYPEs and XHTML 1.0 vs. 1.1.

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):