Many enterprise applications still use ASP.NET Web Forms to support internal portals, customer management systems, reporting dashboards, and business administration tools.
These applications often contain years of business logic, custom server controls, database operations, and integrations with other systems. Replacing them completely can be expensive, especially when the application supports important business operations.
Modern .NET provides a more flexible platform for building web applications, but there is an important limitation: ASP.NET Web Forms is not supported by ASP.NET Core.
This means developers cannot simply change a Web Forms project's target framework and expect its existing .aspx pages, code-behind files, ViewState, and server controls to run on modern .NET.
The user interface needs to be migrated to a supported framework.
One practical approach is to move the application to Blazor while preserving its existing business logic and service integrations wherever possible. AWS Transform for .NET can assist with this process by analyzing Web Forms projects and transforming supported UI components into Blazor components.
The goal is not to rebuild everything at once. It is to move the application toward modern .NET while keeping the existing business functionality available throughout the migration.
Why ASP.NET Web Forms Cannot Run Directly on Modern .NET
ASP.NET Web Forms was designed around the traditional ASP.NET framework and its request-processing model.
It provides features such as:
For example, a typical Web Forms page might contain:
<escape><%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Customers.aspx.cs"
Inherits="LegacyApplication.Customers" %>
<asp:GridView
ID="CustomerGrid"
runat="server"
AutoGenerateColumns="true" />
</escape>
Its code-behind file might look like this:
public partial class Customers : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CustomerGrid.DataSource = GetCustomers();
CustomerGrid.DataBind();
}
}
}
This code depends on System.Web and the Web Forms page lifecycle.
ASP.NET Core uses a different architecture. It provides middleware, dependency injection, routing, Razor Pages, MVC, and Blazor components.
There is no built-in Web Forms page lifecycle or direct equivalent for server controls and ViewState.
Therefore, a Web Forms application needs a UI migration rather than a simple framework upgrade.
Choose a Modern UI Framework Before Migrating
Before changing the application, decide which framework will replace Web Forms.
The most common options are Blazor, ASP.NET Core MVC, and Razor Pages.
Framework | Suitable scenario | Migration consideration |
|---|
Blazor | Applications with interactive server-side UI | Requires converting Web Forms controls and event handling into components |
ASP.NET Core MVC | Applications organized around controllers and views | Requires restructuring pages and request handling |
Razor Pages | Applications with page-oriented functionality | Useful for applications where each page has a clear responsibility |
Blazor is a practical option when the existing application depends heavily on interactive server-side controls.
It supports reusable components, event handling, data binding, and server-side interaction.
AWS Transform uses Blazor as the default target for its Web Forms UI transformation. It can also target MVC Razor views or Razor Pages when instructed through the modernization plan or supported guidance.
The right choice depends on the existing application architecture.
For example, a customer administration portal with many interactive forms and data grids may benefit from Blazor components. A mostly content-oriented application with simple forms may be easier to migrate to Razor Pages.
Do not select a framework only because it requires fewer initial code changes. Consider long-term maintenance, developer skills, component reuse, and hosting requirements.
Understand How AWS Transform Converts Web Forms
AWS Transform for .NET helps modernize supported .NET Framework applications and their UI layers.
For Web Forms applications, it can transform supported Web Application projects into Blazor projects hosted on ASP.NET Core.
The transformation includes changes to important Web Forms files.
Existing Web Forms file | Modernized file | Purpose |
|---|
.aspx
| .razor
| Web pages become Blazor components |
.ascx
| .razor
| User controls become reusable components |
.master
| Layout component | Master Pages become Blazor layouts |
Web.config
| appsettings.json
| Application settings move to modern configuration |
Global.asax
| Program.cs
| Application startup moves to ASP.NET Core hosting |
For example, an existing project might contain:
LegacyApplication/
│
├── Customers.aspx
├── Customers.aspx.cs
├── Orders.aspx
├── Orders.aspx.cs
├── Controls/
│ └── Header.ascx
├── Site.Master
├── Global.asax
└── Web.config
After transformation, the structure may look like:
ModernApplication/
│
├── Components/
│ ├── Pages/
│ │ ├── Customers.razor
│ │ └── Orders.razor
│ │
│ ├── Controls/
│ │ └── Header.razor
│ │
│ └── Layout/
│ └── MainLayout.razor
│
├── wwwroot/
│ ├── css/
│ ├── js/
│ └── images/
│
├── Program.cs
├── appsettings.json
└── ModernApplication.csproj
This provides a starting point for modernization, but generated components still require review.
Not every Web Forms feature has a direct Blazor equivalent. Unsupported controls, custom libraries, and complex page behavior may need manual implementation.
AWS Transform currently supports Web Application projects containing a .csproj file for this UI conversion. Older Web Site projects without a project file need to be converted to Web Application projects before using this workflow.
Replace the Web Forms Page Lifecycle With Blazor Components
One of the biggest migration challenges is replacing the Web Forms page lifecycle.
In Web Forms, developers commonly use events such as:
Page_Init
Page_Load
Page_PreRender
Page_Unload
Modern Blazor components use a different lifecycle.
For example, a component can load its data during OnInitializedAsync.
A simplified Blazor component might look like this:
@page "/customers"
@inject ICustomerService CustomerService
<h3>Customers</h3>
@if (customers is null)
{
<p>Loading customers...</p>
}
else
{
<table class="table">
<thead>
<tr>
<th>Customer ID</th>
<th>Name</th>
<th>Email</th>
</tr>
</thead>
<tbody>
@foreach (var customer in customers)
{
<tr>
<td>@customer.CustomerId</td>
<td>@customer.Name</td>
<td>@customer.Email</td>
</tr>
}
</tbody>
</table>
}
@code {
private List<Customer>? customers;
protected override async Task OnInitializedAsync()
{
customers = await CustomerService.GetCustomersAsync();
}
}
This component displays customer information and loads data asynchronously.
The important difference is that the UI and its behavior are defined together in a component.
There is no IsPostBack check because Blazor does not use the traditional Web Forms PostBack model.
Developers must review existing lifecycle logic and decide where initialization, event handling, and data loading belong in the new component architecture.
Also, avoid moving every operation from Page_Load directly into OnInitializedAsync. Some old pages perform work during every request or PostBack. The new implementation should preserve the intended behavior without repeating unnecessary database calls.
Replace Server Controls With Blazor Components
Web Forms applications frequently depend on controls such as GridView, DetailsView, Repeater, DropDownList, and Button.
These controls manage server-side rendering and event handling through the Web Forms framework.
Blazor uses components instead.
For example, an existing Web Forms button might look like this:
<escape><asp:Button
ID="SaveButton"
runat="server"
Text="Save"
OnClick="SaveButton_Click" />
</escape>
The code-behind method might be:
protected void SaveButton_Click(object sender, EventArgs e)
{
SaveCustomer();
}
In Blazor, the same interaction can be implemented using an event callback:
<button class="btn btn-primary" @onclick="SaveCustomer">
Save
</button>
@code {
private async Task SaveCustomer()
{
await CustomerService.SaveCustomerAsync();
}
}
This is a simpler event-handling model, but the migration must preserve validation, authorization, error handling, and business rules.
For complex applications, reusable components are especially useful.
For example, a customer search form can be implemented once and reused on multiple pages rather than duplicating its markup and event logic.
Migrate ViewState and Session-Based Behavior
ViewState is one of the most important differences between Web Forms and modern ASP.NET Core.
Web Forms uses ViewState to preserve control values and page state across PostBack requests.
Blazor does not provide an equivalent automatic ViewState mechanism.
Instead, developers manage component state explicitly.
Consider a Web Forms page that stores the selected customer in ViewState:
ViewState["SelectedCustomerId"] = customerId;
In a Blazor component, the selected customer can be stored in a component property:
private int? selectedCustomerId;
private void SelectCustomer(int customerId)
{
selectedCustomerId = customerId;
}
This state remains available while the component instance is active.
However, component state is not automatically permanent.
In Blazor Server or interactive server-side hosting, a user can lose component state if the connection is interrupted or the circuit is lost. Important business data should therefore be stored in a database or another durable state store rather than relying only on component memory.
ASP.NET Core also supports session state through middleware, but session state should be used carefully.
For example, storing a temporary workflow identifier may be reasonable. Storing an entire business transaction in session without a recovery strategy is not.
Choose the appropriate state location based on the requirement:
State requirement | Recommended location |
|---|
Temporary UI selection | Component state |
Data shared between components | Scoped application state service |
User-specific temporary information | Session or protected browser storage where appropriate |
Important business transaction | Database |
Long-running workflow | Durable database or workflow state store |
Move Master Pages and User Controls to Reusable Components
Web Forms applications commonly use Master Pages to provide shared navigation, headers, footers, and page layouts.
Blazor provides layout components for the same general purpose.
For example, a layout component can be defined as:
@inherits LayoutComponentBase
<div class="app-layout">
<header>
<h2>Customer Portal</h2>
</header>
<nav>
<a href="/customers">Customers</a>
<a href="/orders">Orders</a>
</nav>
<main>
@Body
</main>
<footer>
<p>Customer Management System</p>
</footer>
</div>
The @Body placeholder represents the content of the page using the layout.
A reusable Web Forms User Control can also become a Blazor component.
For example, a shared header, customer search panel, or notification component can be moved into its own .razor file.
This creates a more modular UI structure and makes future maintenance easier.
Migrate Configuration and Application Startup
Web Forms applications commonly use Web.config and Global.asax.
ASP.NET Core uses Program.cs for application startup and a modern configuration system.
A simplified application startup configuration looks like this:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddScoped<ICustomerService, CustomerService>();
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
app.Run();
This example uses the Blazor Web App hosting model with interactive server components.
The application should also register any required database services, authentication handlers, authorization policies, and logging providers.
Configuration previously stored in Web.config can be moved into appsettings.json or environment-specific configuration providers.
For example:
{
"ConnectionStrings": {
"DefaultConnection": "Server=database;Database=CustomerDb;..."
},
"Application": {
"Name": "Customer Portal"
}
}
Production credentials should not be committed to source control. Use an appropriate secret-management solution and environment-specific configuration.
Handle Third-Party Web Forms Controls
Many enterprise applications depend on third-party UI libraries such as Telerik, DevExpress, or Infragistics.
These libraries may provide advanced controls for:
Data grids.
Reporting.
Charts.
File uploads.
Rich text editing.
Scheduling.
Document management.
The original Web Forms control may not have a compatible version for the target framework.
There are two common approaches.
The first is to replace the control with native Blazor components or a suitable open-source alternative.
The second is to use a compatible version of the same vendor's library for Blazor or another target UI framework.
For example, an application using a Web Forms data grid may need to replace it with a Blazor data grid.
Do not assume that the original control's properties, events, sorting behavior, and paging functionality will transfer automatically.
Create a feature comparison and test the replacement with realistic data volumes.
AWS Transform can identify third-party UI libraries during modernization planning, but some vendor-specific controls require additional manual porting and licensing.
What AWS Transform Does Not Automatically Replace
Automated transformation can accelerate migration, but some Web Forms features require additional work.
The documented limitations include:
.asmx web services.
.svc service files.
.ashx generic handlers.
Service and web references.
Certain mixed Web Forms and Razor project structures.
Web Site projects without a .csproj file.
Unsupported project dependencies.
Some third-party vendor UI libraries.
These components should be identified before starting the migration.
For example, an application may use an .ashx handler for file downloads and an .asmx service for client communication.
The team must decide whether to replace these with ASP.NET Core endpoints, controllers, or another supported service architecture.
AWS Transform can provide a Next Steps document for tasks that need additional attention. Developers should use this report to track remaining work rather than assuming that a successful transformation means every application feature has been migrated.
Test the Application Before Moving to Production
After transforming the Web Forms application, test the complete user experience.
A successful build does not guarantee that all original functionality has been preserved.
Start by comparing the original application with the modernized application.
Important test areas include:
User login and logout.
Navigation and routing.
Form validation.
Database operations.
Data grid sorting and paging.
File uploads and downloads.
Reports and exports.
Session and component state.
Authorization and role-based access.
Error handling and application logging.
Also test behavior under multiple simultaneous users.
Blazor Server maintains server-side connection state for interactive sessions. Teams should evaluate connection management, server memory usage, scaling requirements, and behavior during network interruptions.
For applications with large numbers of concurrent users, performance and capacity testing should be completed before selecting the production hosting configuration.
Best Practices for Modernizing Web Forms Applications
A successful migration requires more than converting .aspx files into .razor files.
Assess the complete solution before starting the migration.
Identify Web Forms controls and third-party dependencies.
Separate business logic from page code-behind files.
Select Blazor, MVC, or Razor Pages based on application requirements.
Preserve business rules while modernizing the UI.
Replace ViewState with explicit state management.
Move important application state into durable storage.
Review authentication and authorization independently.
Replace unsupported handlers and service references.
Test transformed components with realistic business workflows.
Use a staging environment before production deployment.
Keep the original application available until the replacement is validated.
For large applications, migrate one functional area at a time. For example, start with customer management, then move order management, followed by reporting.
This makes it easier to identify problems and gives teams a controlled path toward the new architecture.
Summary
ASP.NET Web Forms applications cannot run directly on ASP.NET Core because Web Forms depends on the traditional .NET Framework and its page lifecycle, server controls, ViewState, and hosting model.
Modernization therefore requires moving the UI to a supported framework such as Blazor, ASP.NET Core MVC, or Razor Pages.
AWS Transform for .NET can help with this process by converting supported Web Forms UI files into Blazor components and assisting with related project and configuration changes.
However, developers must still review generated components, replace unsupported features, migrate state management, address third-party controls, and validate business behavior.
The most practical approach is to preserve existing business logic where possible and modernize the UI in controlled stages.
This allows organizations to move legacy Web Forms applications toward modern .NET without treating the entire system as a completely new development project.
Join the conversation! Your thoughts help the community grow.