ASP.NET Rants and Raves

permanent link
Posted: October 232006

I've got a fairly positive opinion of ASP.NET 2.0. Microsoft has done a lot of good things with this platform. For instance, they have taken care of a lot of plumbing work that many web developers would implement incorrectly. Still, some decisions completely puzzle me:

1. Where the hell is the SqlSiteMapDataSource class? Do any websites with more than a dozen pages actually utilize XML-based sitemap files (the only justification for providing an XmlSiteMapDataSource class but no SqlSiteMapDataSource class)? A lot of developers are rolling their own solution here, and a lot are going to get it done incorrectly. I've had to roll my own SqlSiteMapDataSource class at work and it's a lot like rolling your own comma-separated values parser: it appears like a straightforward task and that it will take you 5 minutes until you're a few hours into it and are dealing with threading and caching issues.

2. The Menu control does everything imaginable out-of-the-box except for what it seems professional web designers would like for it to do. That is to say, they don't want fancy javascript fly-out menus. They tend to prefer static menu drawers. Yes, I'm aware of Adapter classes that override the default HTML. I've had to resort to using an Adapter class on every production site I've used that contains a Menu control. Why was the Menu control's behaviour defined this way?

3. It seems everyone and their brother programs ASP.NET pages with C# even though VB.NET has a few exclusive tricks up its sleeve. VB.NET allows for implicit event binding through the use of the Handles clause. This is a personal preference of mine, but it seems much more natural to programmatically bind a method to an event in this manner than using the programmatic options available in C#, or via the declarative approach in aspx pages. Additionally, I prefer how the Visual Studio 2005 IDE functions with code-behind files programmed in VB.NET as opposed to C#. When using VB.NET, there are 2 drop-down lists at the top of the editor window: one that lists objects; the other that lists the corresponding events for those objects. Clicking on an object in the first column refreshes the second column with the events supported by that object. Clicking on an event in the second column inserts an event handler into your code and makes that event in the second column appear in bold text to let you know you've implemented an event handler. However with C#, the 2 drop-down lists appear to be rather useless. The first lists Types defined in the code-behind file, and the second column lists Members defined in the code-behind file for that Type. Clicking on an item in the second column simply changes focus to the code for that Member. What's the point?