Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

losing session variables

Status
Not open for further replies.

blackrabbit

IS-IT--Management
Aug 22, 2002
204
US
I am running an aps.net application on a windows 2003 server. My session timeout is set to 20 min. Here is my problem:

While tesing some pages that access a SQL database I keep refreshing the page while i make changes to them so I can see if my data is coming in right. As I understood it as long as there was client requests to the web server like clicking links, submitting forms, refreshing the pages, etc. the session would not timeout but would reset the timeout back to the 20 min. That doesn't seem to be happening in my case.

I'm not sure if its doing this after the 20 min or before but I'm losing my session variables not matter how much client activity I have. I'm refreshing the page every 2 to 5 min as I make changes to it. So my session timeout time should never be reached as it keeps refreshing. I'm refreshing the same page over and over to test my changes. The same scripts run each time and there are no scripts on the page that clear the session variables. Has anyone seen this before? Its kind of a pain.
 
Hi blackrabbit

If you are making changes to the code-behind (VB or C#) then this will cause a recompilation of the dll which in turn means the Application is restarted by the web server and all Sessions are lost. This is one of the facts of life when developing asp.net and using sessions.

I don't know wether changes to inline scripts have this effect as I haven't worked with them on anything of enough complexity to require sessions...

Rob

Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Eisenhower 1953
 
I guess that would do it. It doesn't do it though every time i make a change to the page. I'm using .vb files as include files to do most of the major scripting. the only scripts on the aspx page are just for displaying data. I make changes to both the vb and the aspx page and sometimes it will losse sessions and sometimes it won't.

You must be right. I must be making some major change that causes the session to clear. I'll have to log what changes i'm making and then whether or not it happens. If I just play on the web app without making changes like a user would if they were surfing the page it doesn't seem to clear the session in the middle of doing something. Thanks.
 
This happens to me too. Even when I am making HTML changes, not code-behind pages.

If I recompile, yes, I loose all sessions immediately and that is to be expected -- as Rob stated above.

But there are times when I am making cosmetic changes to the *.aspx page and about every 5-6 times I reload, my session ends and I have to log back in again.

Mark
 
thats exactly what is happening to me. I'm not worried about it anymore though. I opened the web site up in IE last night and play around on the site like a user would and it never once lost its session variables, except for when i let it sit for longer than 20 min. As long as it doesn't do it to users and only in development I can deal with it. Thanks guys
 
I was having this problem as well. It would appear to me to run consistently and then suddenly would fail for me as well as for users. I altered my Web.Config file, the section called <sessionState> to mode="StateServer" rather than "InProc" and the problem was permanently solved.

Just thought I would share.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top