disappearing session state variables

W

Wiktor Zychla

Hello there,

I've just encountered a strange problem with Session. In one particular
scenario it is cleared between pages but the scenario is so specific that I
am really, really startled. I've tried to look for similar situations in the
group archive and it seems that few people have observed similar behaviour.
None of them, however, got a clear explanation that would correspond to my
problem.

In my web application I put some information into the Session. On each
page I try to extract that information and if it is not there I just
redirect the user to the login page. It does work everywhere but in one
particular page where I have the <input type="file"> html control that
allows users to upload some data to the server. And now comes the problem:
the data that users upload is the XML file that is split to a bunch of
smaller files at the server side. If at least ONE of smaller files is
overwritten at the server side (because it could have been created before)
the data from the Session variable IS NOT removed. If ALL smaller files are
created as new files, the Session IS cleared out. in the debugger I can see
it clearly: the Session variable is there all the time and after executing
Response.Redirect it is gone at once.

I have found a dirty solution: instead of refreshing the view with
Response.Redirect i use Server.Transer in this one particular situation,
however I do not see any corresponence between Session state, vs creating
new files vs redirecting with Response.Redirect or Server.Transer. to me is
just like the car is not starting anymore because of my new slacks.

any comments on that would be appreciated.

thanks in advance
Wiktor Zychla
 
J

Joe Fallon

I do not have a specific answer to your problem.
But I have had session variables disappear on me.
In all cases there was a page directive that limited the use of session
state to readonly or none.

I added those directives on the assumption that I could get a bit more
performance from those pages but then when the requirements changed and I
added code to use session the variables disappeared. Debugging always lead
back to the directives. But I would waste a few minutes figuring this out.
After being burned by this 2-3 times I ripped out the directives.
Now every page has full access to session variables.

I might add the directives back once the app is complete. But it is way too
much trouble for now when things keep changing.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top