Migrating from ASP.NET Framework to .NET 10 Print

  • 0

Overview

This guide helps you understand the process of migrating from classic ASP.NET Framework (4.x) to modern .NET 10. Migration can improve performance, security, and access to new features.

Before You Begin

Assess Your Application

  • Check dependencies: Some libraries may not have .NET 10 versions
  • Identify breaking changes: Review Microsoft migration documentation
  • Test thoroughly: Plan for extensive testing
  • Consider partial migration: Migrate components incrementally

Key Differences

ASP.NET Framework.NET 10
Windows onlyCross-platform
System.Web basedMicrosoft.AspNetCore based
Global.asaxProgram.cs / Startup.cs
Web.config for everythingappsettings.json + minimal web.config
IIS integratedKestrel + IIS (reverse proxy)

Migration Steps

Step 1: Create New .NET 10 Project

# For MVC
dotnet new mvc -o MyApp.New -f net10.0

# For Web API
dotnet new webapi -o MyApp.New -f net10.0

# For Razor Pages
dotnet new webapp -o MyApp.New -f net10.0

Step 2: Migrate Configuration

From Web.config to appsettings.json:

// appsettings.json
{
  "ConnectionStrings": {
    "DefaultConnection": "Server=localhost;Database=MyDb;..."
  },
  "AppSettings": {
    "Setting1": "Value1"
  }
}

Access in code:

// Old way (ConfigurationManager)
var value = ConfigurationManager.AppSettings["Setting1"];

// New way (IConfiguration)
var value = _configuration["AppSettings:Setting1"];

Step 3: Update NuGet Packages

Replace Framework packages with .NET 10 equivalents:

  • System.Web.MvcMicrosoft.AspNetCore.Mvc
  • EntityFrameworkMicrosoft.EntityFrameworkCore
  • Newtonsoft.JsonSystem.Text.Json (or keep Newtonsoft)

Step 4: Migrate Controllers

// Old (ASP.NET Framework)
public class HomeController : Controller
{
    public ActionResult Index()
    {
        return View();
    }
}

// New (.NET 10)
public class HomeController : Controller
{
    public IActionResult Index()
    {
        return View();
    }
}

Step 5: Update Views

  • Razor syntax is mostly compatible
  • Replace @Html.ActionLink with Tag Helpers
  • Update @Scripts.Render / @Styles.Render

Step 6: Migrate Authentication

ASP.NET Core Identity replaces ASP.NET Membership:

builder.Services.AddDefaultIdentity<IdentityUser>()
    .AddEntityFrameworkStores<ApplicationDbContext>();

Deploying to Plesk

  1. Publish your new .NET 10 application
  2. Upload files to your Plesk hosting
  3. Configure .NET Core settings in Plesk
  4. Set Application Startup File to your main DLL
  5. Test thoroughly

Running Both Versions

During migration, you can run both versions:

  • Use a subdomain for the new .NET 10 version
  • Test and validate before switching
  • Keep the old version as fallback

Common Migration Issues

  • Missing System.Web: Replace with ASP.NET Core equivalents
  • HttpContext.Current: Use dependency injection instead
  • Session state: Configure explicitly in .NET Core
  • Bundling: Use different bundling approach

Resources


Was this answer helpful?

« Back