Visual Studio 2022 includes a surprising new feature: a new preview/visual designer for ASP.Net Web Forms. Web Forms is the oldest ASP.NET framework, runs only on Windows servers, and has received few updates since Visual Studio 2013.

The new Web Live Preview for Web Forms has been a long time coming and is still not enabled by default. It can be enabled in Tools – Options in Visual Studio 2022. It is based on WebView2, a web browser component build on Chromium/Edge. The difference is dramatic, with the new control rendering something much closer to what the user will see at runtime, compared to the old visual designer.

Web Live Preview for Web Forms: a dramatic improvement

Microsoft described the new feature back in July 2021 explaining that it includes live data preview; sync between preview and source so that when a control is selected in the preview, it jumps to that point in the source; live updates when source or CSS files are changed; drag and drop of components from the toolbox onto the preview; double-click a control in the preview to create an event handler; and more. In other words, it has some characteristics of a design tool as well as a preview tool.

Although this is all but a deprecated framework, a developer commented that there are “decades-worth of Web Forms web applications and SharePoint applications that are business-critical, and for which organizations do not have the budget to re-write in another language/platform.”

Another advantage of web forms is its simple programming model. The name of the framework, first released in 2001 as a .NET equivalent to the original ASP (Active Server Pages), echoes that of Windows Forms, the framework for desktop applications, and it has some of the same characteristics. A ViewState variable is a dictionary that preserves state between page refreshes, making web applications behave more like desktop applications.

Both web technology and .NET have moved on from web forms. Single page applications (SPAs) are a modern way to preserve state in a web page, since full page refreshes are not required. Web Forms suffer from problems including difficulty integrating with unit tests, performance issues when ViewState became bloated, and a programming model that tended to intermingle logic and presentation.

That said, the apparent simplicity of Web Forms has been appreciated by many business developers and one of the reasons for Microsoft’s investment in Blazor, a much newer framework, was to recover some of that simplicity.

Even Blazor though does not fix the problem of decades of existing business applications that need maintaining.