Session.abandon in asp.net core

Session.abandon in asp.net core

In this article, how to use Session.abandon in asp.net core, there are two methods of interest. One is the Remove method which allows you to delete individual values from the session collection by key:-

For logout

public IActionResult LogOut()
        {
            HttpContext.Session.Clear();
            return RedirectToAction("Index", "Home");
        }

 

Context.Session.Remove("Name");

2021-10-03