• Blog
  • Migrate from ASP.NET Web Forms to Blazor

Migrate from ASP.NET Web Forms to Blazor

A Complete Guide

Publish date:
Discover more of what matters to you


Migrating WebForms application to Blazor offers several benefits including improvement in overall performance, modern development practices, and cross-platform capabilities. Blazor is a modern web framework from Microsoft that helps developers to build an interactive web application using C# and HTML. To successfully convert WebForms to Blazor, users should have an advanced developer machine with a porting assistant for .NET in their system. This guide will discuss all the necessary environments, tools, benefits of migrating to Blazor, and a complete migration process.

Where and How to Start?

For migrating WebForms application to Blazor successfully, users need to set up a development environment that includes the following components:

Development Environment

This incorporates coders’ required software and devices to develop, debug, and test the codes. It usually involves an inbuilt development environment (IDE) such as Visual Studio or Visual Studio Code with a dotnet core framework for its functionality. It also features a NET SDK to compile and run applications. 

Target Environment

In the case of server-side Blazor, it is assumed that a web server is set up to host ASP.NET Core applications. For client-side Blazor (WebAssembly), the application would be in the user’s web browser; hence, browser and operating system compatibility should be ensured. 

Database Environment

The Blazor app, built by NET WebForms, connects to a database; therefore, database support should be ensured while migrating. Depending on the application type, this could mean Oracle/PostgreSQL, Microsoft SQL Server, MySQL, NoSQL, or any other database.

Network Environment

Network-related issues, such as firewalls, load balancers, and appropriate network configurations, are vital for the communication protocol between the client-side and server-side components of a Blazor application, particularly in the case of a server-side Blazor application. 

Testing Environment

This environment is similar to the production environment in terms of configuration and resources. It is intended to reveal and address any issues at the outset when the product is being developed.

Additionally, several essential tools are required to convert WebForms to Blazor. They include the following: 

  • Visual Studio 2022: This tool supplies a universal IDE for creating and relocating ASP. Migration of NET WebForms applications to Blazor
  • Porting Assistant for .NET: The porting assistant is essential for the evaluation of the process to be taken in the migration. It also automates conversions and provides a look at the process of porting.
  • GitHub Samples: With the help of sample applications from the dotnet architecture GitHub repository, the users can easily understand how the migration process works with the help of coding examples.

Firstly, meeting the important migration conditions is crucial to ensure optimal performance and efficiency when migrating WebForms application to Blazorl. 

Migrate your enterprise software with top developers
We Partner with leading technology companies to enhance our technical expertise and the effectiveness of your unique business requirements with the newest, modern technology
Book a call

Benefits of Migrating to Blazor

Migrating WebForms to Blazor offers various benefits, including the following:

  • Modern development practices. Blazor allows for more modern web development frontends; as a result, C# and .NET have become relevant to web development.
  • Improved Performance. Blazor’s standout features include increased runtime performance, as the runtime only needs to be resolved;
  • Cross-Platform Capabilities. One of Blazor’s advantages is that the developer can run the same communication across various platforms using a cross-platform application, making it easy to deploy on different devices and systems.
  • Unified UI development. The unified UI of Blazor enables developers to build a server and a client using the same languages and frameworks; unlike previous approaches, users can now switch between client and server seamlessly. 
  • Reactive Components. The Blazor’s Components-based architecture provides powerful tools, allowing developers to create feature-rich and interactive interfaces that increase user involvement and engagement.
  • Rapid prototyping and iterative development. Blazor’s support for reactive development pathways and iterative development cycles allows for the swift launch of applications on the market.

These benefits of Blazor create a useful framework for web application development and help in migrating WebForms application to Blazor more easily.

Migrating from ASP.NET WebForms to Blazor

migrating WebForms application to Blazor involves various steps. Here is a detailed step-by-step guide to convert WebForms to Blazor.

Step 1: Assessing a New Solution for Migration

What to do:

  1. Launch the Porting Assistant for .NET.
  2. Select “Assess a new solution” and choose the ASP.NET WebForms application solution file.
  3. Review the assessment report to understand the effort required for porting to Blazor.

How to do:

  1. Open Porting Assistant for .NET.
  2. Click on “Assess a new solution.”
  3. Select the ASP.NET WebForms file in .sln format (eShopOnBlazor).
  4. Kindly follow the provided instructions on the screen and wait for the process to complete.
  5. Recheck the assessment report and work on the highlighted areas that require attention.

Expected Result

Upon completion, the assessment report should provide insights into the readiness to convert WebForms to Blazor. The report should highlight potential challenges and areas requiring modifications.

Step 2: Porting the Application to .NET Core

What to do:

  1. Select “Port project” in Porting Assistant for .NET.
  2. Specify where to save the ported project modifications.
  3. Review and modify port settings if required and initiate the porting process.

How to do:

  1. Open the Porting Assistant for .NET.
  2. Click on “Port project.”
  3. Choose where to save the ported project modifications.
  4. Review and modify the porting settings per the application’s requirements.
  5. Confirm the settings and begin the porting process.
  6. Address any prompts or warnings during the process.

Expected Result

A ported version of the ASP.NET WebForms application is generated. Verify that the porting process is completed without major errors or critical issues.

Step 3: Completing Manual Changes

What to do:

  1. Review the ported code and configuration.
  2. Manually apply any necessary changes, especially related to incompatibilities between WebForms and Blazor.

How to do:

  1. Open the ported Blazor project in Visual Studio.
  2. Review the code, configuration files, and project structure.
  3. Identify and address any code segments or configurations incompatible with Blazor.
  4. Refactor as necessary, ensuring compatibility with the Blazor framework.

Expected Result

After manual changes, the Blazor project should represent the functionalities and features of the original ASP.NET WebForms application. The project should build successfully and there should be no space for errors or warnings in the codebase.

Examples of Code:

Default.aspx (before migration)

BlazorApp.csproj (after migration)

These steps will help the users in migrating WebForms application to Blazor by ensuring a smooth transition to a modern and performance-optimized framework. 

Modernizing ASP.NET WebForms Applications to Blazor using Porting Assistant for .NET

Modernizing ASP.NET to convert WebForms to Blazor through Porting Assistant for the .NET is an effective way to increase productivity, faster innovations, and enjoy the perks of modernity. The following is a list of steps involved: 

Software modernization: when, why, and how?
Check out our article
Check out

Step 1- Assessment

  1. Make a scan of your solution on Porting Assistant for .NET. It will give a report detailing the amount of work that will be required from you in order to move the WebForms application to Blazor.
  2. Refer to the compatibility checklist to determine the needed action.

Step 2- Setup

  1. Make sure that you have a development machine with Visual Studio 2022 already installed.
  2. Download and set up Porting Assistant for .NET.
  3. Target the desired .NET version (e. g. NET 6. 0) in your settings.

Step 3- Sample Application

  1. Obtain a sample ASP. NET WebForms application. You will get one for dotnet architecture GitHub samples.
  2. The WebForms project code can usually be found in the eShopLegacyWebForms folder.

Step 4- Create a New Blazor Project

  1. Start with a new Blazor project for your UI. Blazor allows you to use C# either on the client side or on the server side without having to install browser plugins.
  2. Add all necessary package references for your app.

Step 5- Windows Compatibility Pack 

  1. Install and use Windows Compatibility Pack. This would enable you to run your Windows-only WebForms application on any other operating system. The same pack in ASP provides such functionality.

Step 6- Migrate from Global. asax to Program. Cs

  1. In the WebForms application, replace global. asax/page life cycle runs with the request. cs file. This change follows the Blazor hosting model, and it also reduces the complexity of migration.

Always refer to the official documentation for the complete guide on how to employ a Porting Assistant for the .NET and convert WebForms to Blazor. 

Why Should I Migrate To Blazor 

Migrating to Blazor can be beneficial for several reasons, especially if you’re considering a modernization in your web applications. Here are some of the top reasons to convert WebForms to Blazor:

  • Blazor offers great performance within the framework;
  • It supports modern development tools and patterns for scalability;
  • It reduces the need for javascript to write UIs;
  • Blazor can run across many platforms like Linux and Mac OS, which is not possible in case of WebForms;
  • It can help you integrate with C# and .Net core libraries.

So, the ultimate decision is to go for Blazor to make your system ready for new updated features and technology stacks.

Migrating WebForms application to Blazor is a huge leap in web development letting us achieve more performance, maintainability, and productivity. Here are some useful links to help you to seamlessly convert WebForms to Blazor:

ASP.NET WebForms to Blazor Migration Checklist

  1. Evaluate application complexity and Dependency.
  2. Create a new Blazor project.
  3. Port the current elements and pages.
  4. Refactor server-side logic.
  5. Test and fix the migrated app.
Business analysis of the feasibility of modernization for a company specializing in the development of ERP solutions
Check out a case study from our practice
Check out

Subscribe to our newsletter and get amazing content right in your inbox.

This field is required
This field is required Invalid email address
By submitting data, I agree to the Privacy Policy

Thank you for subscribing!
See you soon... in your inbox!

confirm your subscription, make sure to check your promotions/spam folder

Subscribe to our newsletter and get amazing content right in your inbox.

You can unsubscribe from the newsletter at any time

This field is required
This field is required Invalid email address

You're almost there...

A confirmation was sent to your email

confirm your subscription, make sure to check
your promotions/spam folder