Hi,

How can I get time of last request Sent in asp.net.. Actually I want to set automatic Idle timeout. So I planned to compare this time with current. Please Help me. Other solutions are also invited..

Thanks in Advance.

One possible method would be to set a variable attached to the user's session that records the current time every time an action is carried out.

The only drawback there is that you would need something (like a timer) which would periodically check against that variable and against the current time to validate your timeout period having passed or not. Basically though, if you set a timer for say 10 minutes in length to start when an action is carried out, and at the same time set a variable to contain the current time... when the timer runs out it checks current vs stored and if > your timeout period will end the session.

If, on the other hand, a new action is carried out in the meantime, the timer and the stored time are reset and the session is maintained.

Hope this helps :) Please remember to mark solved once your issue is resolved. Also, it may have been better to have posted this question in the same thread you'd already started relating to timed session expiration :twisted:

in database add one more dateTime field..set default value = getDate();

on every user activity update the database..so DateTime field will be updated and

you get your last request time.

hope that helps

While I don't disagree that your method will work, dnanetwork, writing and reading to the database for every single action the user performs? Seems a bit high in overhead to me.

Agree Lusifer..your way is a correct option..

i thought he wants to track when user was last active..

good job !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.