Interviews - C# Corner

Hitanshi Mehta
How to get new session_id and force session_start() to execute?
By Hitanshi Mehta in .NET onSep 30 2018
  • Hitanshi Mehta
    Sep, 2018 30

    1) Close the existing browser window and then open new instance of same browser. 2) Open new instance of different browser. 3)Use cookie less session. for this set cookieless="true" in web.config.

    • 5
  • harikesh dubey
    Mar, 2019 7

    clear the session on logout execution use below line. hope its clears session value and id both Session.RemoveAll(); HttpContext.Current.Session.Clear(); HttpContext.Current.Session.Abandon(); HttpContext.Current.Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", "")); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1)); Response.Cache.SetNoStore(); Session.Clear(); Session.Abandon(); Response.Cookies["ASP.NET_SessionId"].Value = string.Empty; Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(-10);

    • 2
  • Naveen Bisht
    Nov, 2018 19

    you can use Abandon method of session.

    • 1

Most Popular Companies

Most Popular Job Functions