views:

459

answers:

1

I am working a current web application for a client and I am having some trouble with session variables disappearing on me. I will try and set up a good description of the scenario as best I can. It does not happen on any page other than the page I created to allow users to modify the strings stored in a resource file.

It shows up WHEN: Users navigate to the page, select a resource file from a list and click edit a first time. The page loads the file into a gridview and allows them to edit it. At this point the session variables are being saved a reloaded correctly upon all postbacks. NOW, they click the save button at the bottom to write the resource file to the filesystem (App_LocalResources). They select a new file from the list, attempt to load it and this time the session variables are cleared out and it redirects them to the login page because it does not know there user information.

Additinal details:

It only happens when they click a save button which in turn calls my procedure to write to the resource file.

I am not really doing much in the save function besides writing to a resource file located in App_LocalResources and for some reason this clears out my session variables.

The session variable in question is there user information, which I attempt to get as the very first thing in a page_load method.

This session information is also executed upon every postback via the page_load method.

Thanks everyone, I hope I described this well enough.

+6  A: 

The IIS will reset the application when you change files in the directory associated with the application. Resetting the application will make you loose memory-sessions.

You could put the resource file outside the directory. Or use a stateserver for sessions.

Erik