I am having a very weird issue with session on ASP.NET 2.0. The system I'm working on uses session variables to store parameters on objects (Like Questions and Answers) for generating a report. These are instances of classes of the same name, and so they're populated with parameters as follows:
This report is generated throught 4 aspx pages. First defines location and date parameters, second page stores questions, and third stores answers. The last displays links to generated reports on Excel and HTML formats. All variable data is stored on session, and everything goes well, until the last page, when something like a Session.Abandon() happens, Session_End event is fired and all variables are lost. This happens only once a day, for each logged user on the first use of the report, and then you can try the whole day dozens of times and won't see it again.
The issue happens on the same page ALWAYS, and session mode is InProc.
I have already done the following validations:
Following restrictions apply:
Any thoughts or solutions are helpful. I'll keep in touch for any updates and tests made necessary.
I'd like to thank everyone for the effort!
Me and my team discovered what was happening on this case. There was a method that was deleting temporary files and directories within the Website folder, causing a recycling and session flush. The code was calculating date and time, and was supposed to delete the dirs every 24h, so when a user first logs into the system and generates the report, it deleted the dir and flushed the session.
A couple of suggestions:
What I think is happening is #3. You are setting up the values in a session and then consuming them back out of that session before a postback, where the session value is actually stored. Since it is only happening on the first try, the symptoms mirror this suspicion. If I am correct, you solve this by consuming from the same place you consumed the session value rather than set session and then try to pull from it in the same request.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With