services.AddDistributedMemoryCache(); services.AddSession();
app.UseSession();
HttpContext.Session.SetString("Test", "セッションテスト"); //値セット HttpContext.Session.GetString("Test"); //値取得
@using Microsoft.AspNetCore.Http @inject Microsoft.AspNetCore.Http.IHttpContextAccessor HttpContextAccessor @{ var targetSession = HttpContextAccessor.HttpContext.Session.GetString("target"); }