2
votes

I'm having a problem with ASP Session objects. I set a session variable on one page:

Session("QuestionAmount") = 1

On some computers when I use this variable on another page in the site it works just fine, however on other computers it seems to get lost. I've also noticed that on some computers where it doesnt work, it will work on another browser. My question therefore is: Are session variables not supported by all browsers? (I would've thought they are) as google chrome surprisingly is the browser on which it works least. And is there anything I can do to overcome this problem?

2
ASP Session object uses cookies to maintain it's state look at your browsers cookie accept policy. - user692942
Also They can be counfigured as cookiless - Def
@Def Again the .net references?? Sessions "out of the box" in asp-classic do not provide a cookieless option, you're thinking of a bespoke solution which is not supported by default. - user692942
Cookies are enabled on the computers that aren't working - howdybaby
The only thing I can think of that would affect that is cookies, if your sure that your session cookies are not being blocked and sorry but I'm out of ideas unless you can provide some more information about your setup. - user692942

2 Answers

1
votes

Thanks for all your help everyone. In the end I just reverted to storing data in the url and using request.querystring and it worked just fine. Though all your contributions were read and were helpful for future reference :)

0
votes

Session is an Server object that lives with it. You configure your session in web.config there you can configure it on many ways. If it stores in process it can cause one kind of problems in sql another will apear. May be it is just a timeout there, because the user was idle for a long time(deafult lifetime 20 min) for more information about seesion go there

try to figure out is session ever began or had been ended with

protected void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started

    }
protected void Session_End(Object sender, EventArgs e) 
  {
   // your code here
  }

In my opinion It is a problem with session configuration. Try to config Session to store itself in SqlServer. Example of such cfg could be found in topic i gave.