How to get new session_id and force session_start() to execute?
Hitanshi Mehta
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.
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);
you can use Abandon method of session.