0

I have very strange problem with session data. Problem doesn't appear when using InProc session mode.
This is how it happens:
1. HttpContext.Current.Session["testparam"] = "string value";
2. I check for this data in Page.Unload event. Data is still there.
3. After another request is initiated I can't fetch data in Page.OnInit although I didn't delete it.

Additional facts:
There aren't any serialization errors in log.
Session database is created using this procedure.
Error appears in both IIS and ASP.NET development server.
I tried both SQLServer mode and AppFabric distributed cache mode.

Any help is appreciated since I'm out of ideas.

4
  • can you post the error .. as well as the code where you are assigning the HttpContext.Current.Session var also Onload and onInit code may be helpful..do you have anything like Global.asax page ..? Commented Jan 10, 2012 at 17:20
  • There isn't any error, session variable is set to null in second request (I looked in session EntriesTable). I have global.asax but I don't set session variable values in it. Commented Jan 10, 2012 at 19:46
  • My bad. Don't know how, but I missed obvious serialization exception at the end of output window. I suppose that application kept working because exception occurred during callback. Commented Jan 11, 2012 at 10:02
  • Have you tried fetching the data on Page_Load instead of init? Commented Mar 30, 2012 at 15:20

1 Answer 1

1

Check if EnableSessionState is set to false in the page directive of the second page. If it is set to false, the value will not be fetched from SQL on page load. Whereas, this will not happen in InProc mode.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't use EnableSessionState in any of pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.