SessionID keeps changing in ASP.NET MVC why?

Solution 1:

I've seen that happen even without MVC. If I remember correctly, ASP.NET keeps assigning new session ids until you place something into the Session variable.

Solution 2:

You should initialize the Session object within Global.asax.cs.

void Session_Start(object sender, EventArgs e)
{
    HttpContext.Current.Session.Add("__MyAppSession", string.Empty);
}

This way the session will not change unless your browser window is closed.

Solution 3:

I am working on a .NET MVC cart application and I added

Session["myVar"] = "1234";

to the Page_Load method found in the Default.aspx.cs code. I also added

<%=  this.Session.SessionID %>

to the Site.Master footer. I then rebuilt my app and browsed the various pages of my app and the footer displays the same session id for all pages as expected!