What is the best way to persist a unique id on a browser session in MVC.NET?
Is there some session/cookie ID value by default?
In my Global.asax, I could create a new Session["ID"] and use its ID property.
There's got to be another way?
I tried using
var session = HttpContext.Current.Session;
UserResearch userResearch = new UserResearch();
userResearch.SessionID = sesstion.SessionID.ToString();
But i get an error:
System.NullReferenceException: Object reference not set to an instance of an object
I need to pull initial browser and clicking research based on a user that hasnt logged in to anything, so i need some way to refer to them, hence the id.
I could create a unique id on the sql end and store it in a session, just seems like there should be a more straight forward way.
Is there a browser session id?