It is easy to implement it in client side using script.
It works like this:
(1) When the page OnLoad in client side, set a timeout to process it.
(2) capture mouse activity in this page and reset the timeout
Following is the javascript:
var tID = 0;
var IntTime;
function OnActive(page)
{
clearTimeout(tID);
tID = setTimeout("WindowIdle()", IntTime);
}
function OnPageLoad(page, timeout)
{
var body = page.document.body;
if (timeout > 0)
{
IntTime = timeout;
}
// reset the timeout when the page is active
body.onclick=OnActive;
body.onmousemove=OnActive;
tID = setTimeout("WindowIdle()", IntTime);
}
function WindowIdle()
{
// do whatever you want, usually redirect to another page
}
Hope it is useful.
WYW
"Smithers" <(E-Mail Removed)> wrote in message
news:ODs%(E-Mail Removed)...
> Using .NET 2.0...
> How can I cause Windows Forms application to shut itself down after a
> period (say 15 minutes) of [no user activity]? Specifically, I'm wanting
> some options for detecting that the user is somehow using the application
> (either detect mouse clicks or keyboard input).
>
> The idea is that if the user walks away from their computer and is gone
> for an extended period, then the app will close itself down to help curb
> malicious use.
>
> This is a Windows Forms MDI app.
>
> Thanks.
>
|