Sunday, 15 January 2012

ASP.NET session gets null unexpectly -



ASP.NET session gets null unexpectly -

i have simple scenario. in 1 page of asp.net, store values in session like

session("var") = "some string" or session("var1") = object of generic list of string

and utilize response.redirect goto page. on other page shows things fine, when press button action on it, session gets null.

remember, doesn't happen. , other times works fine. practice lot move values page page (by storing them session , goto other page). have big application , works fine, days, have been having issue on sites users. 1 time again, doesn't happen. 99% works fine few times, have issue session variable no longer available.

is there way know going wrong , where? store other variables in session well, seems fine @ time. of session variables lose values.

from research, seems people blames on iis worker process restart or application pool recycle. believe in such case session variables in application must voided, not selected few. right?

also, there way know in code if pool or worker process restarted?

thanks sameers

perhaps you're passing domain boundaries. session identified client cookie, stored on per-domain basis. so, example, redirect www.whatever.com client.whatever.com cause lose session id, appear "voiding session". so, careful sub-domains too. going whatever.com www.whatever.com fine, other way round, nope.

and yes, unless you're on web farm iis, restarting worker process kill sessions. unless store them in database or something.

asp.net session

No comments:

Post a Comment