Roadmap › ASP.NET Web Forms — Page Life Cycle, ViewState, Controls and State Management › Module: Application Configuration, Security and Errors
Lessons in this course (10)
10. Performance tuning and migrating Web Forms to modern .NET
AdvancedMediumLesson 10 of 10
Performance:
- Disable ViewState where not needed; page GridViews server-side; avoid huge UpdatePanels.
- Output caching:
<%@ OutputCache Duration="60" VaryByParam="id" %>; data caching withCache. compilation debug="false"; bundling and minification; compress static files in IIS.- Async pages (
Async="true"+RegisterAsyncTask) for slow I/O. - Session: avoid storing large objects; use
EnableSessionState="ReadOnly"orFalsewhere possible (session locking serialises requests from one user).
Migration options:
| Target | Effort | Notes |
|---|---|---|
| Stay on .NET Framework 4.8 | None | Supported with Windows; no new features |
| ASP.NET Core MVC / Razor Pages | High (rewrite UI) | Most common target; reuse business/data layers if extracted |
| Blazor (Server or United/Web App) | High | Component + event model feels closer to Web Forms |
| Incremental (strangler) | Medium, spread over time | YARP/IIS ARR routes migrated paths to the new Core app; share auth cookie and database; System.Web adapters help share session |
Steps: extract business logic from code-behind into class libraries (netstandard2.0), add tests, set up the new app beside the old, migrate page by page, retire old pages.