I have used below code to create session id in Asp.net.
var sessionManager = new SessionIDManager();
var sessionId = sessionManager.CreateSessionID(HttpContext.Current);
Can somebody suggest how to do same functionality in asp.net core 3.1???
I have used below code to create session id in Asp.net.
var sessionManager = new SessionIDManager();
var sessionId = sessionManager.CreateSessionID(HttpContext.Current);
Can somebody suggest how to do same functionality in asp.net core 3.1???
Why do you need the Session ID? As you know SessionIDManager
is a ASP.Net full-framework class, so its not available, hence there is probably a newer & better way.
Just beware in ASP.NET core 2.1 that every request.. the session ID changes.. (HttpContex.Session.Id): here is the fix for that, read all 3 top answers: ASP.NET core 2.1 session
Here's a solution, go ahead and set a SessionID yourself using the session:
Session.SetString("SessID", new Guid().ToString());