Microsoft gives Web Forms designer fresh lick of paint in Visual Studio 2022 • The Register

Visual Studio 2022 has a new designer for Web Forms, the original web application framework that goes back to the first release of .NET.

The IDE, currently available as Preview 2.0, embeds a feature called Web Live Preview into the designer for ASP.NET Web Forms. The name Live Preview, however, does not do it justice as it is also possible to edit the text in the visual designer.

The previous visual designer for web forms offered only a rough idea of what the final page would look like, whereas the new one is actually rendered by a web browser.

There are obvious differences in the new designer based on a quick look at the default ASP.NET web forms application, which shows the menu bar from a template called site.master as well as font sizes and layout that looks like the actual page – though web pages are designed to support many different web browsers and screen sizes, so no preview tells the whole story.

Starting a new Web Forms application may be unwise

Starting a new Web Forms application may be unwise

Microsoft senior program manager Sayed Hashimi explained that the new designer’s features include rendering live data in data bound controls, two-way navigation so that selecting a control in the designer navigates to that point in the source, live updates when changes are made to CSS files, drag and drop controls from the toolbox, and double-click of controls to generate a default event handler.

The old and new web form designers – new on the right

The old and new web form designers – new on the right

Overall it is a big tooling update, even if the capabilities of the underlying framework are unchanged. ASP.NET Web Forms is a more or less frozen technology, being dependent on the old Windows-only .NET Framework rather than the new .NET Core/.NET 5 and higher.

The last significant update was in April 2018, with the release of .NET Framework 4.7.2, which added support for SameSite cookies and Dependency Injection. Microsoft has a paper on strategies for migrating ASP.Net Web Forms apps, suggesting that developers consider migrating code to Web APIs and/or porting applications to Blazor, a newer framework that supports writing C# code to run in the browser via WebAssembly.

The Web Forms framework was warmly taken up by developers back in 2002, especially by Windows desktop developers who were not accustomed to the stateless nature of the web.

The Web Forms abstraction managed state behind the scenes, using a giant hidden variable called VIEWSTATE, as well as providing drag-and-drop controls that could be coded on the server with C# or VB.NET, avoiding much need to tangle with JavaScript (one of the reasons Microsoft considers Blazor a natural replacement).

Web Forms is a leaky abstraction, though, and can soon become a burden. Careless coding could result in a huge VIEWSTATE that slowed performance. It was easy to intermingle user interface code and business logic. Another issue is that when browser technology charged ahead, trying to avoid JavaScript was the wrong thing to do. Microsoft developed ASP.NET MVC, first released in March 2009, as a solution to the shortcomings of Web Forms.

This being the case, why is Microsoft updating the tooling for Web Forms in Visual Studio 2022? That is one thing Hashimi did not tell us; but note that .NET Framework is a component of Windows and therefore supported for as long as the version of Windows it comes with.

“Support for .NET 4.8 follows the Lifecycle Policy of the parent OS,” Microsoft says, which means at least until 1 September 2029 (end of support for Windows Server 2019), and in practice later than that since the company will continue to ship .NET Framework with new versions of Windows.

Many Web Form applications are custom business applications where modern features take a back seat to being able to perform the tasks for which they were designed. While it may not make sense to start a new Web Forms application, maintaining existing ones is another matter and this framework, like its companion Windows Forms, is one that refuses to die. ®