I have been an ASP.NET developer since it was invented, and a legacy ASP developer before that. For long I spent most of my time doing ASP.NET Web Forms and it was OK: I remember lots of weird problems that needed extensive trial and error –debugging, but things weren’t that bad.
Then ASP.NET MVC came and I got interested. In the (massive) client project I worked for at that time I bent some Web forms concepts to the extreme and didn’t like it too much. MVC felt very light and as it embraced HTML it was very good for the new rising of HTML(5).
Fast forward three years: I have used MVC a lot, I have presented it in conferences, liked it, and I have not touched Web forms at all. Until this week I needed to change hosting of the old North pole expedition site (www.pohjoisnapa.fi) and of course make a couple of tweaks since the site felt outdated (which is no wonder as it has not been touched since 2006).
Here are some of the feelings and problems I had when touching my own Web forms code:
- Oh god how ugly the views are. Lots of ceremony for little amount of result HTML.
- Web forms really embrace data binding, everything should be done with it. But data binding brings so many limitations it makes you write all kinds of weird stuff like having two similar tags (e.g. images) and then a visibility rule to show/hide them based on the condition as you cannot easily use conditionals inside data binding expressions. This doubles the amount of view code. After MVC this feels so dirty and wrong.
- Seriously: an asp:MultiView, asp:View, asp:Repeater and an ItemTemplate, all that to be able to do one if-else and one for loop within a view.
- “Let’s add Google analytics to master page if the request is not local”… results in weird error about not being able to use code blocks somewhere because of some reason I could not understand anymore. Some Googling and I decided it is easier to just always include the analytics script.
- Web site and Web application project mismatch: one is good for something and other for something else. I should not have to know that. I used to remember those by heart but not anymore.
- Text resource (meta:resourcekey=”hell”) handling is broken. There isn’t a better story on MVC side but somehow in Web forms you really see how hard the built in resource framework is to use.
- Request pipeline is way too complicated and takes years of learning before you can master it. MVC pipeline is simple and the hooks are clearly defined and documented.
It’s official: I am not going to touch ASP.NET Web forms anymore. ASP.NET MVC or REST+HTML5+Ajax is my world (until something better comes along).
P.s. I admit, that if I needed to create a new web site with Web forms right now I would of course be able to make it look cleaner than the site I just touched. Still that would again be bending Web forms to something it is not created for.