Click here to Skip to main content
15,844,498 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a web app (VS 2005 / .Net v 2.050727) that uses a session variable to store a dataset. I'm using a grid that has link buttons in some of the columns. When I click on a link it opens another browser window that accesses the session variable. Sometimes the session variable has a value and sometimes it will return null. Any ideas?????????

1 solution

Depending on the configuration of your system there are several reasons for the application's worker process to be recycled thus eliminating all stored session variables. Please see my solution to this question: object reference not set to instance of object[^]. Also look into the comments of this solution. This should give you some ideas.

Hope this helps!

Best Regards,
Share this answer
pmcmillon 29-Aug-11 15:44pm    
Let me be more clear. I can click on a link button in the grid and the session variable is there and I get the appropriate result. I close the second browser window I just opened and click the same link and the session variable returns null. in is not a recyucle issue.

Here a one web.config setting I have used to try and eliminate this problem:

<pre lang="xml"><system.web>
<pages renderAllHiddenFieldsAtTopOfForm="true"></pages></pre>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900