How to get time of last request in asp.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • visweswaran2830
    New Member
    • Nov 2009
    • 92

    How to get time of last request in asp.net

    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.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    The answer to this question depends on how you have implemented your project.

    Did you use Session?
    InProc Session, by default, times out after 20 minutes. You can handle the Session_End event (in the Global.asax file) to clean up any resources. Please note that it doesn't necessarily mean that the Session_End event is going to be executed after 20 minutes of the user being idle (when session expires)...the Session_End event is executed when the Session ID is recycled.

    Check out this article on Sessions for more information.

    If you aren't using session...then you'll have to tell us what you are using so that we can make suggestions.

    -Frinny

    Comment

    • visweswaran2830
      New Member
      • Nov 2009
      • 92

      #3
      Thanks for response.

      Actually I am using cookies. My main objective is to redirect the user to login page, if the user idles around 20 minutes.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Well, I think I'd use JavaScript to check the cookie ever 20 minutes to see if the cookie has indicated that the time has expired. I would redirect the user to the login page using JavaScript.

        You could redirect the user server side but this can only happen if the user posts back to the website...

        -Frinny

        Comment

        • iohos
          Banned
          New Member
          • Jul 2010
          • 45

          #5
          <system.web>

          <sessionState timeout="30"></sessionState>

          </system.web>



          <system.web>

          <sessionState timeout="30"></sessionState>

          </system.web>

          Comment

          Working...