Share via


Modernize ASP.NET and ASP.NET Core web applications

In the App Modernization Guidance for Azure, optimization cycles are the time to move legacy web applications based on ASP.NET to more modern frameworks. The strategy you use depends on your starting point. For example, ASP.NET Core MVC applications can be replatformed and deployed using Azure App Service for Linux. However, earlier frameworks first need to be moved to ASP.NET Core or .NET 5.0 and higher, and code refactoring is required.

Modernizing ASP.NET web applications can help you improve cross-platform support, scalability, and performance. In addition, developers get a simpler, modern experience, plus support for cloud-native capabilities such as microservices and Docker containers.

Replatforming sets the stage for your next modernization steps. For example, when time and budget allow, you might rebuild your application using containers or serverless computing to further reduce operational costs while gaining mobility and flexibility.

Checklist for modernization

In general, to modernize ASP.NET applications, do the following:

  1. Upgrade your project and configuration.

    • Migrate your project to ASP.NET Core, using the .NET Upgrade Assistant to automate where you can.
    • Replace web.config with appsettings.json in the configuration settings.
  2. Refactor code.

    • Use dependency injection in ASP.NET Core to manage dependencies more effectively and make your code easier to test and maintain.
    • Convert synchronous code to asynchronous using async and await keywords to improve scalability and responsiveness.
  3. Modernize the front end.

    • Replace Web Forms with Razor Pages or Blazor for a more modern, efficient way to build the user interface.
    • To enhance the user experience and improve performance, integrate modern client-side frameworks such as Angular, React, or Vue.js.
  4. Adopt Azure PaaS.

  5. Enhance security.

    • Ensure your application uses HTTPS and implement HTTP Strict Transport Security (HSTS) to protect against man-in-the-middle attacks.
    • For more secure user authentication, implement modern authentication and authorization protocols such as OAuth and OpenID Connect.
  6. Test and automate.

    • Write unit tests for your code using a framework such as xUnit or NUnit to make sure your code is reliable and maintainable.
    • Consider using Application Insights Code Optimizations for .NET to get code analyses, recommendations, performance monitoring, and CI/CD integration with Azure DevOps.
    • Set up continuous integration (CI) and continuous delivery (CD) pipelines using Azure DevOps or GitHub Actions to automate the build, test, and deployment processes.

For more information about this approach, see the Architect Modern Web Applications with ASP.NET Core and Azure white paper.

Next steps

Continue your optimization journey and scale your operations to drive business agility.