Hi all, in my app a user places an order and should be assigned a new session id.

Then they should be able to place a new order using this session id so as not to ovewrite their previous orders data. Unfortunately the only way I can get a new session id is by calling

HttpContext.Current.Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));

which then logs the user out.

If I call

System.Web.Security.FormsAuthentication.SetAuthCookie(username, true);

to log the user back in HttpContext.Current.User.Identity.IsAuthenticated == false and so they still have to log in.

Is there a way that I can create a new session and keep the user logged in, or create a new session and then log the user in programmatically without them being redirected?

7 Years
Discussion Span
Last Post by melphic

Thanks adatapost, but I found my issue wasn't that IsAuthenticated was false after all.

I just needed to redirect the page back to itself for the new session to take, and then set all the session variables I had by previously storing them and then retrieving them.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.