Losing session variables

  • Thread starter Thread starter M
  • Start date Start date
M

M

Have you come accross the issue described below or know more about it?

We have come accross a situation where session variables are getting
lost temporarily but come back again if user reloads the same page.

Found that whenever the server has to load/compile (not sure which) the
website dlls (for eg the first time a page is requested from a website) and
if the browser makes a subsequent request for another page (for eg the first
page contains an iframe) then the session variables are not visible in the
second page. Strangely the session variables become visible if the browser
re-submits the request. Normally the compile/load process only happens the
first time a page is accessed but our virus scanner appears to be amending
some file in the website (web.config perhaps) and so the web server
re-loads/re-compiles the dll's quite frequently.

We have got around this by not using an iframe in the offending page and
excluding the website directory (for now) in the virus scanner.
 
That is the correct behavior. Session objects are mapped into the same app
domain process space of which the page request is being served. Therefor
session variables will be susceptible to process recycling and app domain
unloads. You've taken the appropriate action here. All should be well. The
iframe part should not have any effect on session values, but keeping the
virus scanner away from the webconfig files is the cure. Also keep the
indexing service away from that directory as well.
 
Thanks Alvin, was useful to get some confirmation about this. I will also
look into the tip about the indexing service.
 
Back
Top