SessionID keeps changing in ASP.NET MVC why?

前端 未结 8 1524
傲寒
傲寒 2020-12-08 02:02

I am trying to keep track of something and using the SessionID as they key to that object

However the SessionID every 2-3 reqiests changes shouldn\'t it remain the s

相关标签:
8条回答
  • 2020-12-08 02:49

    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!

    0 讨论(0)
  • 2020-12-08 02:50

    I was having the same problem using ASP.NET Web Forms. I just had to add a global.asax file to the solution and the fixed it for me.

    0 讨论(0)
提交回复
热议问题