ASP.NET Web Forms to Blazor Blueprint
Modernize ASP.NET Web Forms to Blazor on modern .NET by extracting business logic behind an ASP.NET Core API and rebuilding postback pages as components, migrating page groups incrementally.
What and Why
ASP.NET Web Forms relies on server-side postbacks, ViewState, and an event-driven page lifecycle that is heavy, hard to test, and tied to the legacy .NET Framework. Blazor (on modern .NET) offers a component-based model with C# in the browser (WebAssembly) or over a real-time connection (Server), aligning the web tier with current .NET. This blueprint modernizes Web Forms to Blazor while reusing sound business logic.
Phases
Assessment. Inventory .aspx pages, user controls (.ascx), code-behind, ViewState usage, and data access. Separate business logic from page-lifecycle logic. Identify third-party Web Forms controls needing replacement.
API extraction. Move business and data logic into a clean .NET class library and expose an ASP.NET Core Web API with OpenAPI contracts and hexagonal boundaries. This decouples logic from the UI and removes ViewState dependence.
Component rebuild. Recreate pages as Blazor components with a component library and accessible markup. Choose a hosting model (Blazor Server for simpler stateful apps, WebAssembly or Auto for richer client interactivity). Replace ViewState-driven state with explicit component state and services.
Auth and state. Replace Forms Authentication/Membership with ASP.NET Core Identity or OIDC. Replace Session/ViewState patterns with scoped services and proper state management.
Cutover. Run Web Forms and Blazor side by side behind a reverse proxy or shared shell, migrating page groups incrementally, then retire the Web Forms app and .NET Framework dependency.
Key Risks and Mitigations
- Logic buried in code-behind: Extract to the API/class library with tests during migration.
- Third-party controls: Find Blazor-native replacements early.
- Skills gap: Blazor's component model and lifecycle differ from Web Forms; train the team.
Recommended Tooling
ASP.NET Core, Blazor (Server/WebAssembly/Auto), OpenAPI, ASP.NET Core Identity or OIDC, a Blazor component library, xUnit, and Playwright for end-to-end tests. Use a reverse proxy for incremental cutover.
Success Metrics
Improved maintainability and testability, faster lead time, better performance without ViewState overhead, and removal of legacy .NET Framework dependence.
Prerequisites
Access to source and database, .NET expertise, a test suite, and a chosen Blazor hosting model. Reuse business logic; do not rewrite working rules unnecessarily.