As the returning reader may have noticed I have used the Model-View-Controller framework for ASP.NET again and again in the few posts I have produced so far. This is because unlike the ASP.NET standard framework, the MVC framework allows and simplifies actual programming in lieu of VB3 style component hell. To show proof of my benevolent and magnanimous generosity, I have however decided to let go of my loathing for the standard ASP.NET setup and actually try to make something out of it, utilizing every bit of it just to see if it can be used for anything real.
Orientation
There is a plethora of Server Controls, at least one for every imaginable application known to man. The idea is that when you have a business problem you want to solve, you simply write <asp: in front of a general description of your problem. switch to Design view and edit the properties of your server control.
Example:
I would like to create a wizard that allows me to create a ASP.NET Forms user account… Let’s try it:
Hmm… that would mean… ‘<asp:’ and then, let’s try .. ‘ CreateUserWizard />’ … Switch to design view… Woah!!!
This is just one example, but the amount of server controls out there is limitless and you can watch your ViewState go from 0 – 60MB in seconds with ease, building your website with themeable data bound server controls fully integrated with your web.config.
I have seen people dismiss the MVC framework as it means ‘a move away from Server Controls back to spaghetti code’. I find this unfathomable. Server controls try to abstract away the fact that this the application runs on a web server which is inherently stateless. Through the use of ViewState and other constructs the server controls use a variety of dirty tricks behind the scenes to hide this basic fact from the confused developer. In practice however I have never seen a case where this abstraction has been successful and there have always been places in a web application that have deteriorated into near-ASP Classic monstrosities.
I have always put the blame for this squarely on the shoulders of the ASP.NET Server Control concept. However, I have decided to actually put my money where my mouth is on this one and actually make a serious effort to build something usable out of a bucket of server controls and see if it can actually be done. For real. All the way.
Example
I am going to build an application that uses the following aspects of the ASP.NET basic features:
- ASP.NET Forms Authentication
- Themes
- Profiles
- Wizard
- DataGrid
- GridView
- DetailsView
- DataGrid
- MultiView
- … any other controls that I find irresistibly disturbing
I have a useful scenario which I have been working with, however I will not release the details of this yet, and I will only briefly discuss the actual application. The point of this exercise is whether or not the controls are useful, how difficult they are to manage in a professional way and the amount of ugly code that is necessary to patch things up. I will go through this anxiety ridden journey on my own and spare you most of the details and only report back when I need to vent or when I, maybe, reach points of success. I do this so that I will reach a point where I can disrespect the ASP.NET framework with greater authority. I admit there is a risk I may come out on the other side a changed man, a born-again VB3 fanatic, touting opaque server logic, horribly leaky abstractions and other features as reigning supreme over so-called real programming, we never know.