Just about a month ago, Microsoft announced ASP.NET 5, what's being characterized as a ground-up rewrite of this venerable framework. Improvement big and small abound; two of the ones I'm looking forward to the most are TagHelpers and support for Dependency Injection. Those changes alone are enough to make me jump on the bandwagon, and I'm already looking forward to VS2015 Beta.
Buried in the announcement was this little nugget:
Your existing Web Forms apps will continue to run without modification on IIS with .NET 4.6. You can’t use Web Forms apps with the cloud-optimized runtime.
Do my eyes deceive me? Because that looks like WebForms will not be supported in .NET 5. But that can't be right! Microsoft has made such a big deal about supporting both MVC and WebForms in the past.
But it appears that this is the case. WebForms will only be supported in .NET 4.6 and below. To which I can only say: Finally!
Now, I'm an unabashed MVC fanboy, so take everything I say with a pound of salt, but I couldn't be happier with this decision. I'm sure it was a long time coming, and probably made some Microsoft execs very nervous, but this is absolutely the right choice.
WebForms has been the bane of my existence for years. It's only real benefit is development speed; you can get simple line-of-business apps up and running using WebForms in no time with little effort. But there are so many downsides:
- ViewState: WebForms has to store a huge hidden field called ViewState with all the states of all the controls somewhere on the page. This is so the system can maintain the state of the page. In large, complex pages, the ViewState can grow to be absolutely enormous, and its mere existence hinders client-side debugging (why is there a 120-line hidden field full of jargon in my HTML?)
- One Form: WebForms only allows one form per page, since each page must be able to post its contents. That means that any post action submits all inputs, which is submitting a lot of extra data that isn't necessarily needed to perform the action.
- Controls: WebForms wants you to use controls like asp:Button and asp:GridView in their pages, but their implementations (particularly CheckBoxList) are so full of cruft and confusion that it's very difficult to debug them when something is wrong.
In short, WebForms lies to you about the way the web works. It wants you to think the web can maintain state; the web is stateless. It wants you to think you can only have one form, but you can have as many as you want, provided they don't wrap each other. It wants you to use its proprietary javscript and control libraries, when really the web only cares about HTML. It's so focused on making the web work like applications that it actively fights against the design of the web rather than working with it.
Obviously, it's still going to be a long time before WebForms is actually dead and buried, but the reaper has been notified. WebForms's time is coming, and I couldn't be happier about it. Let's all welcome the coming death of WebForms!