migrating-mvc-session-state

Migrate ASP.NET Framework session state, TempData, and application state to ASP.NET Core.

19|2|Updated May 13, 2026
One-click install
npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-mvc-session-state
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrating-mvc-session-state
Source: https://github.com/microsoft/upgrade-agent-plugins/tree/main/plugins/upgrade-agent/extenders/upgrade-dotnet/upgrade/skills/lazy/web/mvc/migrating-mvc-session-state
Command: npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-mvc-session-state

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the challenge of migrating session state, TempData, and application state from ASP.NET Framework to ASP.NET Core, ensuring a smooth transition without data loss.

Core Features & Use Cases

  • Session State Migration: Converts HttpSessionState to ISession with distributed cache backend.
  • TempData Migration: Migrates TempData from session-based to cookie-based provider.
  • Application State and Cache Replacement: Replaces HttpContext.Application and HttpRuntime.Cache with DI-based IMemoryCache or IDistributedCache.
  • Use Case: Ideal for upgrading MVC or WebAPI apps that rely on session-based state patterns and need a seamless transition to ASP.NET Core.

Quick Start

Migrate your ASP.NET Framework session state to ASP.NET Core using the 'migrating-mvc-session-state' skill.

Frequently Asked Questions about migrating-mvc-session-state

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate session state from ASP.NET Framework to ASP.NET Core?

TempData migration moves TempData from a session-based provider to a cookie-based provider in ASP.NET Core. This allows you to retain temporary state data patterns when upgrading from the older framework.

What is the best way to replace HttpRuntime.Cache and HttpContext.Application in ASP.NET Core?

The best way to replace HttpRuntime.Cache and HttpContext.Application is by using DI-based IMemoryCache or IDistributedCache solutions. This adapts your application state management to the dependency injection architecture of ASP.NET Core.

Do I need knowledge of distributed caching to migrate MVC session state to ASP.NET Core?

Yes, you need knowledge of ASP.NET Core session management and distributed caching to migrate MVC session state. This prerequisite knowledge is required to properly configure the ISession backend and ensure state persistence.

Can I migrate WebAPI application state to ASP.NET Core using dependency injection?

Yes, you can migrate WebAPI application state to ASP.NET Core by replacing legacy state patterns with dependency injection. The migration replaces HttpContext.Application with DI-based IMemoryCache or IDistributedCache solutions.

Why does TempData migration require switching from session-based to cookie-based providers?

TempData migration switches from session-based to cookie-based providers because ASP.NET Core uses a different TempData architecture. This shift allows temporary data to persist across redirects without relying on server-side session storage.