Strange session timeout problem(urgent help needed).

J

jensen bredal

Hello,
i'm struggling with a somehow badly understood session scenario.
I provide acces to my pages based on form authentication using
Session cookies.

Som of my pages are supposed to be running continuously and refreshing once
an hour.
I there set timeout= 61 in <sessionState section and on my page it says
<meta http-equiv="refresh" content="3600">.
I also set timeout=120 in the <forms section of web.config to make sure
the cookie does not expire before the session has been renewed.

But anyway i'm getting the temeout every 3600 seconds.
Can someone explain this?

Many thanks in advance.

JB
 
J

Juan T. Llibre

Actually, it makes a lot of sense that, if you have
timeout= 61 in <sessionState, that the sessions
would expire in approximately 3600 seconds.

Remember that the timeout value is expressed in minutes.

If you need a higher expiration time for your sessions,
set timeout= in <sessionState to 120, if that's what you need.

If you do, the sessions will expire in 7200 seconds.

Take note that the larger the session expiration time,
the more memory consumption and that, at some point,
you might wind up with a recycled application due to
lack of sufficient RAM, and all your sessions will expire anyway.

You will have to experiment and look for a trade-off between
configured session expiration time and application recycling time.
 
J

jensen bredal

But then how do i avoid my session to timeout still keeping the refresh
time to 1 hour (3600 seconds)?
 
J

Juan T. Llibre

The refresh time is immaterial.

If you have your session timeout set to 20 minutes,
and have a meta refresh, in all your pages, set to 19 minutes,
you could have your sessions continually refreshed, without the
need to accumulate RAM resources over 120 minutes.

As long as a user has a page at your site open, the sessions
would be automatically extended for another 20 minutes.

If they close all pages at your site, i.e., if they go away
permanently, then the sessions would expire 20 minutes
after the last page open was refreshed.

There's really no need to have large session timeout values.
 
J

jensen bredal

in my case i want to do a refresh every hour (<meta http-equiv="refresh"
content="3600">).so i set timeout=61. But this fails unexpectedely.
Why?



can i have session tiemout=20 when
 
J

Juan T. Llibre

Are you using out-of-process session state managemenet ?
( State Server or SQL Server ? )

If you are, Session_OnEnd might not get called.

Session_OnEnd only gets called if using InProc
( in-process ) session state management.

With SQL Server, there's a way to clean up
the expired sessions by running a SQL job.
 
J

jensen bredal

No i'm not using out of process session.



Juan T. Llibre said:
Are you using out-of-process session state managemenet ?
( State Server or SQL Server ? )

If you are, Session_OnEnd might not get called.

Session_OnEnd only gets called if using InProc
( in-process ) session state management.

With SQL Server, there's a way to clean up
the expired sessions by running a SQL job.
 
J

Juan T. Llibre

I'd suggest you test with smaller values,
so that you can run a number of tests
to check whether it runs OK or not.

Try setting timeout to 1 and refresh to 2.
That will allow you to test faster.

Then, depending on the results, you can increment.

If I recall correctly, the maximum session
timeout value is 1440 minutes, or 24 hours.

Anything higher than that will throw an error.
 
J

jensen bredal

Strangely there is no problem with small values up to about 30 minutes!

i tried 1 , 2 , 15 .....30. No timeout or what so ever.
 
J

Juan T. Llibre

re:
Strangely there is no problem with small values up to about 30 minutes!

That's not strange at all, if the maximum session
timeout value is 1440 minutes, or 24 hours,
as explained in my last message.

Anything higher than that will throw an error.

Sorry for not remembering that figure earlier.
 
J

jensen bredal

There you lost me again. My application has a page ( a news ticker) that
dinamicaly rotates records from a database. It should get new data every
hour . But when that is reached , then the session cookie expires. The sign
of that is that users are prompted with the login page.


But . I managed to set session timeout larger then refresh time. The refresh
should renew the session and 60 minutes should be really be much less then
24 hours. If that is the maximum value?
Shouldn't it. So i do not understand why this works for 30 minutes and not
for 60 minutes.



There are three things here:

1)The session cookie timeout,(i'm using session cookies for from login , not
persistant cookies)

-greater then refresh time
2)refresh time
-less then seeion cookie timeout and session timeout

3) Session timeout
-greater then refresh time

Does this make any sens?
 
J

Juan T. Llibre

re:
If that is the maximum value?

It is.
I just double-checked, and the maximum timeout period is 1440 minutes.

re:
So i do not understand why this works for 30 minutes and not for 60
minutes.

I don't understand either. It should work for 60 minutes,
by setting the timeout to 60 and the refresh to, say, 3500.

The refresh is set in seconds; the timeout in minutes.

re:
I managed to set session timeout larger then refresh time.

What values did you set for both ?
 
J

jensen bredal

re:
I don't understand either. It should work for 60 minutes,
by setting the timeout to 60 and the refresh to, say, 3500.

The refresh is set in seconds; the timeout in minutes.

re:

What values did you set for both ?

session cookie :
<forms ....loginUrl="Login.aspx" protection="All" timeout="60" path="/">


session timeout:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="60"
/>

refresh:

<meta http-equiv="refresh" content="3500">
 
J

Joe Joe

The sign of that is that users are prompted with the login page.

You said you are using forms authentication: the login page prompt could
be because the forms authentication cookie has timed out.

Did you set slidingExpriation="true" in the <forms> element (default is
false for .NET 1.1)?

Also you could try increasing the session timeout a bit at a time (62,
63, ...) or decreasing the refresh interval a bit at a time (3650, 3640,
...) until it works.

And put some tracing in the Session_Start and Session_End to see when it
expires.
 
J

Juan T. Llibre

That should work, as it apparently does.

So, the problem was not really the settings for the
session timeout, nor the meta refresh timeout, but with
the cookie timeout, huh ?
 
J

jensen bredal

slidingExpriation="true"

you got a point there. i did set to false because i thought the default was
true and not working. i will
try that.
thanks
 
G

Guest

Have you checked to see if the asp.net worker process is being aborted
unexpectedly? If it is, it looks like a session timeout when in reality it
is just dumping the session when the worker process goes down.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top