A couple of days ago a Web Platform User Group meeting was held at Microsoft Bulgaria's office. It was a well attended discussion and I hope also a useful one. The topic was “ASP.NET Web Forms vs. ASP.NET MVC vs. ASP.NET Web Pages” or shortly called “ASP.NET Frameworks”.
Although we were sure the above technologies were already familiar ones, the point with this meeting was to see if we can consider some rules and questions that will help us decide when to use one instead of another. In a very brief way here is what we talked about:
ASP.NET Web Forms
A mature (and the oldest of the three) technology aimed mainly at rapid development, simulating stateful model of the Web. With its postback and event-driven model provides a small learning curve when a windows forms developer should transfer to web forms.
MVC pattern-based architecture of the developed applications. Allows developers to have very fine tuning control over the final HTML. SEO inclined with clear separation of concerns of the system components and TDD oriented.
ASP.NET Web Pages
Have the same full control over HTML as with the ASP.NET MVC case and uses Razor syntax. WebMatrix is a small and free IDE tool for Web Pages completing the whole idea for simplicity of this web development case. The main target here is not using commercial development products when you need to create a relatively small web site for demonstration, education, and in rarer cases commercial purposes.
Here are the full presentation: WPUG_ASP.NET_Frameworks.pdf (540.94 kb) and demos: WPUG_ASP.NET_Frameworks_Demos.zip (3.36 mb) for more details.
As developers we are quite often put in a situation of trying to find the right solution of a currently emerging problem. The immense information we have at hand (eyes) with internet might not always be useful, instead if you think about it, it can be in a way a bit wicked… Wicked so that it makes us copy and reuse ready-made fragments which leads to our tasks being finished as soon as possible. What I am trying to imply is that if we want to reuse our own knowledge, we should try to be aware of the fundamentals of the technologies we utilize.
Some of the basic, yet important aspects of ASP.NET state management a developer should have in mind:
- Try to see the whole picture of state management in web applications in general (cookies, hidden fields, parameterized addresses)
- Then above all – know a page lifecycle. It comes very handy when you wonder what is executed first, the button click event handler or the page load one :).
- What comes next is see what goodies we have in ASP.NET in particular – view state, application state, session state
- Last - you can check how to manipulate request/response objects in .NET
A presentation from a Sofia University course referring to the above matters: ASP.NET-State-Management.pdf (12.48 mb)
…and the demos for it: State-Management-Demos.rar (44.68 kb)