АSP.NET Web Forms modernization series, Part 4: Single page applications and modern .NET
This is part 4 in a series of blog posts dedicated to ASP.NET Web Forms Мodernization. The series expands on the topics discussed in our Migration Guide: ASP.NET Web Forms to Modern ASP.NET whitepaper – a compilation of technical considerations for modernizing legacy .NET web applications, gathered from our experience at Resolute Software doing many .NET modernization projects.
Here is a list of all articles in the ASP.NET Web Forms modernization series:
- Part 1 – Data Access Layer Considerations
- Part 2 – Business Logic Layer Considerations
- Part 3 – UI Layer Considerations
- Part 4 – Single Page Application Framework Considerations (you are here!)
Coming up next (stick around!):
- Part 5 – Server Application Considerations
- Part 6 – Testing, Deployment and Operational Considerations
Single Page Applications (SPAs) are a thing. A big thing. If you’re not familiar with SPAs, they emulate a desktop application experience within a web app, providing fluid and seamless user interaction. This approach contrasts with traditional multi-page applications, which reload from the server every time a user requests a different page.
There should be little doubt that SPAs have transformed the web development landscape, and while SPAs are not in any way dependent on the use of .NET, modern .NET does offer some very attractive benefits, particularly for Microsoft stack developers.
In case you’re not familiar with .NET, it is the latest iteration of Microsoft’s .NET platform. (It can get confusing. See Versions of .NET for the latest info.) An open-source, cross-platform framework, .NET is a significant redesign of the earlier .NET Framework, with a focus on modularity, performance, and cross-platform compatibility. .NET includes ASP.NET Core, a high-performance, extensible framework for building modern web applications.
Single page applications with modern .NET
On the server-side, .NET provides RESTful APIs that expose data and services to the client-side.In a .NET SPA, the server-side app and the client-side app are developed independently and can be hosted separately. However, during development, the .NET SPA services offer useful features like proxying requests to the client-side app, thus enabling integrated client-server debugging.
Why use modern .NET for SPAs?
Okay then. You can use .NET for SPA development, but should you?
Clearly, if you are working on a project using the .NET stack, it makes sense. But .NET brings several benefits to SPA development beyond simple convenience.
Modern .NET is comparatively lightweight compared to previous .NET versions. This does result in higher performance, which can result in faster server-side code execution and, therefore, faster response times for API calls.
With .NET, developers can build and run apps on multiple platforms, including Windows, MacOS, and Linux.
Modularity and flexibility
The .NET modular design enables developers to include only the necessary packages, resulting in lighter, more efficient applications.
With Visual Studio and Visual Studio Code, .NET offers strong tooling that makes coding, debugging, and testing easier. No doubt, developing SPAs on modern .NET is just easier if you’re already invested in the Microsoft stack and C#.
Community and corporate support
.NET is an open-source framework, and it enjoys good community support in addition to strong corporate support and regular updates from Microsoft.
Even though Reddit and StackOverflow host disagreements bordering on religious wars when it comes to the Microsoft stack, you can build some great SPAs using it. And if you’re already familiar with the dev environment or like coding in C#, you should really consider getting .NET for SPA development.
Why NOT to use .NET for SPAs
- Learning Curve
When not to use SPAs at all
Just because I think SPAs are better than sliced bread doesn’t mean they’re right for you. If your website looks a lot like a collection of ‘About Us’ pages, I doubt you’ll benefit from SPAs.
But really, if your website doesn’t require a lot of user interaction, and you don’t push a lot of data updates, you might be just fine serving whole HTML web pages for every user interaction.
One of the biggest challenges of using SPAs is Search Engine Optimization (SEO). Because so much SPA content is generated by script, there is precious little HTML in place for an SEO bot to crawl and index. Google and Microsoft are getting better at managing this, but they’re still far from perfect. If you want help getting your SPA to index correctly with SEOs, drop us a line. We’d be happy to help.
The bottom line
Upgrade your Single Page Applications with modern .NET and unlock its powerful benefits. Get our migration guide today for a seamless transition and enhanced development experience.