Stupid .NET

7 Jan

The development platform where I work is .NET and as such I’ve started using it with a view to tying as much of our on and offline systems together as possible. For example, I’m working on an app at the moment that will submit an online mortgage application form straight into our customer management database. This would have untold benefits, mainly in terms of data security as the database is offline except for when the connection to the remote server is made and also it means our web server overhead is lessened as we have no need for an online database.

I can see the benefits of .NET and I think its a great idea – one language, one interface over many platforms and all that. However, as seems to increasingly be the case with Microsoft products, they’ve only done 75% of the work. The missing 25% is the same area they neglected with IE – rendering markup. .NET cannot, at the time of writing, produce valid XHTML. Here’s an example bit of code. Lets say I want a form:

How cool is that? No more specifying where and how – all thats done in the behind the scenes code (.NET does seperate functionality very very well it must be said). However, when that gets rendered to the browser it comes out as:


What the…? Try getting that to validate. Why do Microsoft do this? Its like they tempt you in with their brilliant premise (and .NET is functionally superb, lets be in no doubt about that) but then for a company that are supposed to be so pro-web they let you down with bad implemntation.

Now, there are workarounds for this particular scenario but, just like with IE – there shouldn’t have to be! I simply cannot for the life of me understand why Microsoft do this. Its like they purposefully go out to piss off those designers who care about their code. I understand that the 2005 version of Visual Studio will fix XHTML compliancy but surely it would be quicker and easier (and cheaper!) to just do it right the first time! Seriously, how hard can it be?

6 Responses to “Stupid .NET”

  1. Phil Baines January 11, 2005 at 11:27 #

    Ahh yes! the coding problems with .Net are not new to me. I have had to deal with them many times, and I will even admit to admitting defeat at some points (normally only if the project is in house, or an administrator panel where the code isn’t user greater scrutany).

    It is a real pain in the bum tho. Maybe you would like to document some of the ‘work arounds’ that you know of?

  2. Kev January 11, 2005 at 14:28 #

    For this particular problem, the best solution is to extend the basic .NET controls. As I’m fairly new to .NET a developer friend of mine worked up a solution. I think what I’ll do is get him to write something up as it’ll be more coherent than anything I write!

  3. Sadish January 18, 2005 at 16:21 #

    But even the output you have shown, seems to be a valid xhtml. isnt it ?

    why do you care if they had to use some meta data about the page’s current state in a hidden control., and there are also options to turn off the viewstate..isnt it ?

  4. Kev January 18, 2005 at 18:27 #

    @Sadish: No, its not valid. There’s no ‘name’ attribute in a form and the generated hidden field gives the validator headaches resulting in:

    The document type does not allow element input here because input is an inline tag when a block-level tag was expected.

    It puts the hidden field before even the fieldset tag.

    The trouble with forms though is just the tip of the icberg – trying to use .NET’s built in form validation presents more headaches.

  5. Charles Young June 17, 2005 at 12:01 #

    I agree that the Visual Studio 2003 toolset could do a better job of generating HTML, but these particular criticisms are unfair. ASP.NET has not changed fundamentally since its release in early 2001. At that time, it is true that XHTML 1.0 was already a W3C recommendation. However, hardly any developers had heard of it, and there was almost no use of it on the public Internet. The toolset broadly represents what was common/best practice in 2001, and it’s really only in the last couple of years that XHTML has really begun to gain momentum in mainstream web development. Microsoft are responding to this in VS 2005.

    Taking the two specific issues in the HTML example, the use of ‘name’ is entirely valid in HTML 4.01, and was a good choice in 2001 when there were still a lot of older browsers out there. Because of typing issues, XHTML introduced an additional constraint here that means effectively that only ‘id’ can be used.

    The other issue is a the use of as a child of . HTML 4.01 allows as a direct child of in the transitional DTD, but not in the strict DTD. Likewise, the above example is entirely valid when validated against the transitional XHTML XSD schema, but is invalid in relation to the strict XHTML schema.

  6. Kev June 17, 2005 at 14:11 #

    Shamefacedly, I admit it – you’re totally right Charles. My timeline is way off. Thanks for the heads up ;o)

Comments are closed.