Web Timers

Discussion in 'ASP .Net' started by Girish Pal Singh, Aug 13, 2003.

  1. I want if a user is browsing the site for some time say 30 minutes
    then the current his session should end data should be posted back,
    how could i do it.
    ?
    Girish Pal Singh, Aug 13, 2003
    #1
    1. Advertising

  2. Girish,

    You'll have to do that with client side javascript.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche


    "Girish Pal Singh" <> wrote in message
    news:...
    > I want if a user is browsing the site for some time say 30 minutes
    > then the current his session should end data should be posted back,
    > how could i do it.
    > ?
    S. Justin Gengo, Aug 13, 2003
    #2
    1. Advertising

  3. You could create a method that

    1. Checks for the existence of a Session "TimeStarted" variable
    a. If it doesn't exist, create it and place the Current Time in it
    2. Checks the Current Time against the Session variable
    3. If the interval of difference is greater than your alloted time, take
    some action.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "Girish Pal Singh" <> wrote in message
    news:...
    > I want if a user is browsing the site for some time say 30 minutes
    > then the current his session should end data should be posted back,
    > how could i do it.
    > ?
    Kevin Spencer, Aug 13, 2003
    #3
  4. Forgot to mention. Of course, the method I described would be placed in
    every Page that the user might visit, and execute in the Page_Load method.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    http://www.takempis.com
    Neither a follower nor a lender be.

    "Girish Pal Singh" <> wrote in message
    news:...
    > I want if a user is browsing the site for some time say 30 minutes
    > then the current his session should end data should be posted back,
    > how could i do it.
    > ?
    Kevin Spencer, Aug 13, 2003
    #4
  5. I am not quite sure why would you want to post the data.
    The data can be incomplete or user was not going to submit his data at all.

    If you just want to prevent his session from an expiration then there is a
    simple method.

    1. Create transparent.gif image 1x1 pixel.
    2. create SessionRefresh.aspx page which outputs back to the browser that
    image.
    3. On the page which might take more than 20 minutes to fill out ( or any
    page you want )
    put following code somewhere.

    <img src="transparent.gif" width=1 height=1 name="sessionrefresh">
    <script>
    window.setInterval("document.images['sessionrefresh'].src=sessionrefresh.asp
    x;", 10*1000*60 );
    </script>

    So basically JavaScript will request every 10 minutes the
    sessionrefresh.aspx and thus preventing session from expiration.

    Also note that cashing might be a problem but you can always add ?param=time
    in javascript to the end of sessionrefreshh.aspx. To prevent cashing.


    George.

    "Girish Pal Singh" <> wrote in message
    news:...
    > I want if a user is browsing the site for some time say 30 minutes
    > then the current his session should end data should be posted back,
    > how could i do it.
    > ?
    George Ter-Saakov, Aug 13, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Inkpen

    Timers in application web programming

    Stephen Inkpen, Jul 16, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    342
    Ken Cox [Microsoft MVP]
    Jul 16, 2003
  2. Kelsang Wangchuk

    System.Timers.Timer vs. System.Threading.Timer

    Kelsang Wangchuk, Jul 31, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    716
    Kelsang Wangchuk
    Jul 31, 2003
  3. Girish Pal Singh

    timers

    Girish Pal Singh, Aug 11, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    562
    Kevin Spencer
    Aug 11, 2003
  4. Steve C. Orr [MVP, MCSD]

    Re: timers

    Steve C. Orr [MVP, MCSD], Dec 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    393
    Steve C. Orr [MVP, MCSD]
    Dec 8, 2003
  5. Jeff Greenland

    .NET Timers aborting in web application

    Jeff Greenland, Dec 18, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    563
    Jeff Greenland
    Dec 18, 2003
Loading...

Share This Page