I had a strange problem when a session ends after a postback, when I debug it in visual studio 2010.
I store the variable in the session on the first page. It retains its value on the next page, but after that it is lost. It returns a null value. The strange thing is, when I copy the exact code to dev or test servers, it works fine ...
Any ideas what could happen? Thank you
UPDATE
The code is pretty simple. I have a default.aspx page where I set the session variable:
HttpContext.Current.Session["PurchaseOID"] = purchaseOID;
When I click Next, the Default.aspx page redirects it to the Information.aspx page. Additional user information is collected on this page (using the DevExpress controls). When I click Next on this page, the PurhcaseOID session variable returns null when the page loads.
protected void Page_Load(object sender, EventArgs e) { if(HttpContext.Current.Session["PurchaseOID"] == null){ throw new Exception("error!"); } }
Oddly enough, the session is saved when the page loads for the first time. But in postback, it loses its variables. Also, this is what JUST started to happen. I have been working on this code for a month or so, and it works fine. When I deploy this exact code to our dev or test server, it works fine.
I am debugging this in Cassini. Help will be greatly appreciated, thanks!
Shahzad Chaudhary
source share