Link to home
Start Free TrialLog in
Avatar of vpekulas
vpekulas

asked on

Session dropping at random and always prematurely


I've developed an application for our in-house use and it works nicely, except that the session are dropped by the server prematurely at random and no reason
is given.This is a problem since most of the time users spend in the admin and I need the sessions there.
 
- There are no entries on the server in the application logs or other logs.
- The bin folder is not being updated or written to.
- As far as I know the application is not recompiled by the server. (guess)
 
So my question is, how to find out the reason for the problem ? What are the reasons for this ?

Though it might not be necessary, I've also attached a sample application that shows how the other application was developed - it's just 5 pages but shows the
concept. In case there is something wrong with that :)

Available here: http://www.helpconnection.net/_Sample.zip

Thanks for your help.
Avatar of strickdd
strickdd
Flag of United States of America image

Check your IIS settings and see if you have an application pool set up for this site. If so, make sure it is not recycling as often. This is usually the cause.
Avatar of vpekulas
vpekulas

ASKER

This has happened now on 3 different server, including the dev machine where there is no application pool set-up.
Make sure you don't have Session.Abandon() anywhere in your code.
ASKER CERTIFIED SOLUTION
Avatar of quanmac
quanmac

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
are u using relative paths in all places where u r redirecting the user to a new webpage .. if not, the session gets dropped ..

Rejo
Hi Guys:,

Rejo - yes, the users stay only within the application pages and don't leave. When I redirect I use relative URL's most of the time. E.g.:
Response.Redirect("../../index.aspx", True)

Quanmac  - I'll give this a try, though isn't it just hiding the real problem ? I mean even with InProc it should work ....

strickdd - I use the Session.Abandon() only on the user logg out, no where else, this is not the cause of my problem.


Thanks you for your input so far ! Any more ideas ?

Any other ideas ? :)
>>When I redirect I use relative URL's most of the time
most of the time?? so is the code for the other cases gettting fired anytime here .. note that session is lost if u redirect without using the relative path ..

Rejo
Most of the time because I might have used a full URL, but if you are getting to sessions being domain specific, then the application never leaves it's place, the sessions are set and read from the same place.
>> if you are getting to sessions being domain specific ..
no .. but when u give the complete URL for redirection .. its as good as navigating to a new website and so a new session id is generated .. try changing them and verying whether they were the problem area ..

Rejo
I'll have to test it, but I'd be very surprised if that was the case. The URL (domain) would have to be different from the one being redirected for the session to be dropped. For example missing www would do that ....
using the full path for redirection would be the problem for dropping sessions and I have mentioned that above ..
Rejojohny: Would be but that wasn't the case, I never used full URL's.

I never found out why it keeps on doing that, but switched to <sessionState mode="StateServer" cookieless="false" timeout="20" />
which took the session state out of the application process. Solved the problem for now, I'm just hoping it doesn't only hide the cause.