Mennan
Mennan

Reputation: 4497

How to detect page is not in use for more 10 min?

I want to set session as unlimitted by refreshing page every 10mins.

So i have to know page is using or not using right now ?

My refreshing code is working fine:

 string _CurUrl = Request.RawUrl.ToString();
 Response.AppendHeader("Refresh", "600; URL=" + _CurUrl  + "");

Upvotes: 0

Views: 2302

Answers (2)

Microsoft DN
Microsoft DN

Reputation: 10030

You should track keyPress and mouseMove events as nunespascal suggested-

Here is the link. This might help you

http://forums.asp.net/t/1312010.aspx

Upvotes: 0

Tim B James
Tim B James

Reputation: 20364

There are various jQuery plugins for detecting if a user is idle.

jQuery idleTimer plugin - Paul Irish (Code on GitHub)

jQuery Idle Timeout Plugin - Eric Hynds (Code on GitHub)

Auto Timeout Plugin - Philip Almieri (Code on GitHub)

Google Search Results for more solutions.

I would use one of these rather than try to code something yourself which already exists. You will however have to customise the event which occurs when the TimeOut is detected to refresh the page.

Upvotes: 3

Related Questions