It seems easy for people to say things like “LOL, Web Forms” or “Web Forms is dead.”?Web Forms sometimes?gets very little respect from the .NET development community. We look forward in time, forgetting the giants on whose shoulders we stand. It was the?dominant way of making websites in .NET for many years. Is it really a remnant of a bygone era? Or does it have a vibrant existence in places oft overlooked?
Is Web Forms Really Dead?
Web Forms?has lessened in popularity, sure. But is the technology truly?dead?
I remember thinking that it would die with the advent of ASP.NET MVC. But I was naive then. I didn’t really understand the landscape, nor did I appreciate the value of a long-lived, stable technology?platform on which to build applications. I had my frustrations with Web Forms and let that color my judgment. But can we objectively say Web Forms is dead?
No, it’s not dead. Or rather, it’s complicated. Microsoft hasn’t announced any plans to stop supporting Web Forms, and in fact, they’ve released updates for it as recently as April 2018. Web Forms continues to get love and support from them. It’s shown?maturity and stability and receives?respect from many across the internet.
However, Web Forms is part of the ASP.NET full framework. And Microsft?focuses most of its attention on .NET Core, the framework’s cross-platform rewrite. So I suspect someday we’ll see the sun set on the full framework. But I don’t think that will be for many years. This is a common occurrence with Microsoft technologies, like VB.NET,?but even if one of Microsoft’s tools fades into the background, it ain’t over till it’s over!
Should I Stay or Should I Go?
But a larger question remains: should you still use Web Forms or migrate to a newer technology?
I can’t really answer this question for you. I know, disappointing. But you need to make this assessment for yourself and your team. However, I can tell you to make this assessment based on the nature of the tools you’re using. Look at what ASP.NET Core MVC or Razor Pages is going to give you over Web Forms?and vice versa. Avoid making a case based on whether the technology is “hot” or not.
Using Web Forms even today is a perfectly viable option and can be a really good fit, in some cases. In fact, there may be a larger potential talent pool to train on it than for MVC frameworks, as I will explain below.
SPAs: Web Forms in Its Newest…Form
Things in the software industry seem to come in cycles, and web technologies are no different. Many in the profession continue to look always forward to the new, leaving the old in the dust, until the old becomes new again. Web Forms falls in this boat. When you take a close look, it resembles a style of application that’s very popular at the time of this writing and shows no signs of slowing down: the single page application (SPA). The similarities between Web Forms and SPAs means that there may be more opportunity now for using it than just a few years ago.
Event Models and State
First, let me explain a little about how Web Forms works. Then I’ll move on to how popular SPA frameworks work.
Web Forms’ goal is to provide an interactive application experience like you would get on a desktop?but within a web application.
It achieves this by taking the user’s button clicks and other events and posting back to the same webpage but with different data rendered, simulating a dynamic update. It’s able to do this while consistently maintaining the “state” of the application by?using a hidden web input called a ViewState. (You can learn more about all of this here.) It then runs through a series of page lifecycle events that ensure the ViewState gets deserialized and/or updated appropriately. This all culminates in a Render() call that renders the HTML to a page and sends it to the browser.
Was It Ahead of Its Time?
Web Forms uses events to provide a stateful view of the web. It makes you ask if it was ahead of its time.
React’s Model and How It Lines Up
React is an interesting beast. It looks quite similar to Web Forms:
- React and Web Forms both culminate in a Render() method that sends HTML to the browser.
- React has a State object used to render all of its components. Web Forms has a ViewState object that’s used for the same.
- Both frameworks take?advantage of their State/ViewState object through a series of lifecycle events to ensure everything gets rendered and maintained properly.
So we see that things have really come full circle. We’re at a phase in our industry where we once more value event-focused interactivity within a website. We also understand that we need an event model and way to maintain state in order to achieve this.
Interactivity With the Power of the Server
Web Forms, as mentioned above, is designed to make interactive pages within a website. And we see that tools that make interactive sites are as valuable as ever. This means that Web Forms, too, has the potential to be as valuable as ever.
We get a couple advantages with Web Forms over SPAs, though.
- We get the power of an entire web server backing up our logic processing. An SPA only gets the power of a browser, which is a constant struggle. This is the equivalent of getting a Boeing 747 to power your travel vs. a motor scooter.
- We get a mature, long-lived framework in Web Forms as opposed to newer, ever-shifting SPA frameworks like Angular. This means even guides written 10 years ago are still applicable to our work today.
This emergence of curiosity into event-driven, stateful interactivity on the web may have another side effect. If you’re a shop running Web Forms, your talent pool may have increased with the number of people invested in SPAs. If you spin your job descriptions right, you may see an influx of these people looking for interactive, stateful web design.
The models between SPAs and Web Forms are so similar that an SPA-experienced developer may learn Web Forms faster than they would an MVC platform. Think about it: when people were learning Web Forms back in the day, they were coming from a stateless Classic ASP world and found the stateful nature of Web Forms hard. But now many developers are used to the idea of state management on the browser and could find the page lifecycle second nature.
Niche Services Make You Money
There are many jobs out there needing Web Forms. It’s more of a niche need in software?fewer companies are turning to the technology. This means that those that need expertise will find help scarcer and, in turn, this means you can have a stronger influence over your pay.
Don’t get me wrong. There are still plenty of jobs for Web Forms. But the need is greater, and so can be your compensation.
A Place In Our Hearts and Our Toolset
Web Forms does indeed seem to be a remnant of our past. But it still has much life left. Perhaps Web Forms was before its time, but it helped pave the way for concepts like SPAs. Many companies still use Web Forms today. There is still much money to be had as it has become a niche market. And we can transpose many lessons from the?SPA community onto it, making onboarding easier. Web Forms may not be the shiniest, sharpest tool, but it still has a place?in our toolset and in our hearts.