RenewSession State Before Expiration In .Net 1.1

W

WhiskeyRomeo

The below appears to be a partial answer to my problem but I don't to keep
sessions alive simply because a user has wondered off to do something else.
Session timeout is set to the standard 30 minutes.

KEEPALIVE.aspx has:
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",8000);
}
MyRegPage.aspx has:
<IFRAME id=KEEPALIVE src="KEEPALIVE.aspx"
frameBorder=no width=0 height=0 runat="server"></IFRAME>

I am not a JavaScript programmer but have some very basic skills, how can I
use this solution but add an alert button that pops up at the 17 minute mark
and if they click Ok the KeepAlive.aspx refreshes. If there is no response
(by the 20 minute mark) the alert box goes away and is replaced by one that
says "Your Session has timed out. Go to . . ."

wr
 
A

Alvin Bruney [ASP.NET MVP]

No, that's not a good approach. Think security, I open several hundred
connections and now since you allow me to keep those active sessions open,
I'll eventually cause your server to run out of memory. If the user walks
away, the session should time out otherwise, they need to be at the
computer - this long standing design makes sense for a number of different
reasons and you should stick to it. Having said that, I've done this as well
but set the app pool to recycle at midnight to 'somewhat' mitigate the
resource threat. I hope my rambling makes sense to you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
 
W

WhiskeyRomeo

Yes, thanks for replying -- I know it is a bad approach hence the question
how can I use JavaScript to control it?

WR

Alvin Bruney said:
No, that's not a good approach. Think security, I open several hundred
connections and now since you allow me to keep those active sessions open,
I'll eventually cause your server to run out of memory. If the user walks
away, the session should time out otherwise, they need to be at the
computer - this long standing design makes sense for a number of different
reasons and you should stick to it. Having said that, I've done this as well
but set the app pool to recycle at midnight to 'somewhat' mitigate the
resource threat. I hope my rambling makes sense to you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



WhiskeyRomeo said:
The below appears to be a partial answer to my problem but I don't to keep
sessions alive simply because a user has wondered off to do something
else.
Session timeout is set to the standard 30 minutes.

KEEPALIVE.aspx has:
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",8000);
}
MyRegPage.aspx has:
<IFRAME id=KEEPALIVE src="KEEPALIVE.aspx"
frameBorder=no width=0 height=0 runat="server"></IFRAME>

I am not a JavaScript programmer but have some very basic skills, how can
I
use this solution but add an alert button that pops up at the 17 minute
mark
and if they click Ok the KeepAlive.aspx refreshes. If there is no
response
(by the 20 minute mark) the alert box goes away and is replaced by one
that
says "Your Session has timed out. Go to . . ."

wr
 
A

Alvin Bruney [ASP.NET MVP]

I had code for this but I can't find it. Here's how I remember doing it.
Create a function that pops a message box. Capture the return value from the
message box click. Let's call that function A. Map your mouse move events to
another function, let's call that function B. Inside function B, you call
the javascript clearTimeout and reset the timer with a call to setTimeout.
When the user is at the computer working the mouse move events will keep
rescheduling the timer. Inside Function A, you call setTimeout with a
suitable time and pass in function A so that function A is called after the
time expires. If the mouse never moves, the timer will run out and the
function A will be called. Function A should ideally pop an alert box and
then redirect the user to a login page. The redirection happens after the
user clicks ok. If the user never comes back the message box remains.
Settimeout etc
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



WhiskeyRomeo said:
Yes, thanks for replying -- I know it is a bad approach hence the question
how can I use JavaScript to control it?

WR

Alvin Bruney said:
No, that's not a good approach. Think security, I open several hundred
connections and now since you allow me to keep those active sessions
open,
I'll eventually cause your server to run out of memory. If the user walks
away, the session should time out otherwise, they need to be at the
computer - this long standing design makes sense for a number of
different
reasons and you should stick to it. Having said that, I've done this as
well
but set the app pool to recycle at midnight to 'somewhat' mitigate the
resource threat. I hope my rambling makes sense to you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



WhiskeyRomeo said:
The below appears to be a partial answer to my problem but I don't to
keep
sessions alive simply because a user has wondered off to do something
else.
Session timeout is set to the standard 30 minutes.

KEEPALIVE.aspx has:
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",8000);
}
MyRegPage.aspx has:
<IFRAME id=KEEPALIVE src="KEEPALIVE.aspx"
frameBorder=no width=0 height=0 runat="server"></IFRAME>

I am not a JavaScript programmer but have some very basic skills, how
can
I
use this solution but add an alert button that pops up at the 17 minute
mark
and if they click Ok the KeepAlive.aspx refreshes. If there is no
response
(by the 20 minute mark) the alert box goes away and is replaced by one
that
says "Your Session has timed out. Go to . . ."

wr
 
W

WhiskeyRomeo

This is all well and good (you are keeping time on the client). But how is
the session state (on the server) kept alive when the use clicks OK on the
alert box button? Once a page loads and there is no post for 20 minutes, his
session should time out. So rather than keeping time via mouse movements, I
just want to keep time between loading of a page and between postbacks. The
alert box should pop up at least 3 minutes before session time expires.
Since I am not going to keep track of session time on the server, I am going
to assume it starts over on page load or on a post back -- like your
suggestion says -- and kept a timer on the client.

If the user clicks OK on the alert box, he should remain on the page he is
on and an invisible post back happens to keep the session alive.

WR

Alvin Bruney said:
I had code for this but I can't find it. Here's how I remember doing it.
Create a function that pops a message box. Capture the return value from the
message box click. Let's call that function A. Map your mouse move events to
another function, let's call that function B. Inside function B, you call
the javascript clearTimeout and reset the timer with a call to setTimeout.
When the user is at the computer working the mouse move events will keep
rescheduling the timer. Inside Function A, you call setTimeout with a
suitable time and pass in function A so that function A is called after the
time expires. If the mouse never moves, the timer will run out and the
function A will be called. Function A should ideally pop an alert box and
then redirect the user to a login page. The redirection happens after the
user clicks ok. If the user never comes back the message box remains.
Settimeout etc
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



WhiskeyRomeo said:
Yes, thanks for replying -- I know it is a bad approach hence the question
how can I use JavaScript to control it?

WR

Alvin Bruney said:
No, that's not a good approach. Think security, I open several hundred
connections and now since you allow me to keep those active sessions
open,
I'll eventually cause your server to run out of memory. If the user walks
away, the session should time out otherwise, they need to be at the
computer - this long standing design makes sense for a number of
different
reasons and you should stick to it. Having said that, I've done this as
well
but set the app pool to recycle at midnight to 'somewhat' mitigate the
resource threat. I hope my rambling makes sense to you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



The below appears to be a partial answer to my problem but I don't to
keep
sessions alive simply because a user has wondered off to do something
else.
Session timeout is set to the standard 30 minutes.

KEEPALIVE.aspx has:
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",8000);
}
MyRegPage.aspx has:
<IFRAME id=KEEPALIVE src="KEEPALIVE.aspx"
frameBorder=no width=0 height=0 runat="server"></IFRAME>

I am not a JavaScript programmer but have some very basic skills, how
can
I
use this solution but add an alert button that pops up at the 17 minute
mark
and if they click Ok the KeepAlive.aspx refreshes. If there is no
response
(by the 20 minute mark) the alert box goes away and is replaced by one
that
says "Your Session has timed out. Go to . . ."

wr
 
A

Alvin Bruney [ASP.NET MVP]

These are two different clocks unrelated to each other where client clock is
(server clock - 3min) so that client always times out before server. In your
case you can, on server click ok, fire an AJAX dummy call.
to assume it starts over on page load or on a post back -- like your
suggestion says -- and kept a timer on the client. Right.

the session state (on the server) kept alive when the use clicks OK on the
alert box button? Once a page loads and there is no post for 20 minutes,
his
session should time out. So rather than keeping time via mouse movements,
I
just want to keep time between loading of a page and between postbacks.
The

Right, but there is no event that fires on the server that allows you to do
that. If you handle session end, it's too late. There's no
Session_AbouttoEnd event that is available, although that may be a good
feature improvement. The only thing that comes to mind is client clock set
to some value less than the server timeout clock and these two are reset
with each mouse movement.
--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



WhiskeyRomeo said:
This is all well and good (you are keeping time on the client). But how
is
the session state (on the server) kept alive when the use clicks OK on the
alert box button? Once a page loads and there is no post for 20 minutes,
his
session should time out. So rather than keeping time via mouse movements,
I
just want to keep time between loading of a page and between postbacks.
The
alert box should pop up at least 3 minutes before session time expires.
Since I am not going to keep track of session time on the server, I am
going
to assume it starts over on page load or on a post back -- like your
suggestion says -- and kept a timer on the client.

If the user clicks OK on the alert box, he should remain on the page he is
on and an invisible post back happens to keep the session alive.

WR

Alvin Bruney said:
I had code for this but I can't find it. Here's how I remember doing it.
Create a function that pops a message box. Capture the return value from
the
message box click. Let's call that function A. Map your mouse move events
to
another function, let's call that function B. Inside function B, you call
the javascript clearTimeout and reset the timer with a call to
setTimeout.
When the user is at the computer working the mouse move events will keep
rescheduling the timer. Inside Function A, you call setTimeout with a
suitable time and pass in function A so that function A is called after
the
time expires. If the mouse never moves, the timer will run out and the
function A will be called. Function A should ideally pop an alert box and
then redirect the user to a login page. The redirection happens after the
user clicks ok. If the user never comes back the message box remains.
Settimeout etc
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



WhiskeyRomeo said:
Yes, thanks for replying -- I know it is a bad approach hence the
question
how can I use JavaScript to control it?

WR

:

No, that's not a good approach. Think security, I open several hundred
connections and now since you allow me to keep those active sessions
open,
I'll eventually cause your server to run out of memory. If the user
walks
away, the session should time out otherwise, they need to be at the
computer - this long standing design makes sense for a number of
different
reasons and you should stick to it. Having said that, I've done this
as
well
but set the app pool to recycle at midnight to 'somewhat' mitigate the
resource threat. I hope my rambling makes sense to you.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------



message
The below appears to be a partial answer to my problem but I don't
to
keep
sessions alive simply because a user has wondered off to do
something
else.
Session timeout is set to the standard 30 minutes.

KEEPALIVE.aspx has:
private void Page_Load(object sender, System.EventArgs e)
{
Response.AddHeader("Refresh",8000);
}
MyRegPage.aspx has:
<IFRAME id=KEEPALIVE src="KEEPALIVE.aspx"
frameBorder=no width=0 height=0 runat="server"></IFRAME>

I am not a JavaScript programmer but have some very basic skills,
how
can
I
use this solution but add an alert button that pops up at the 17
minute
mark
and if they click Ok the KeepAlive.aspx refreshes. If there is no
response
(by the 20 minute mark) the alert box goes away and is replaced by
one
that
says "Your Session has timed out. Go to . . ."

wr
 

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

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top