Re: timer function

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Philipp Sumi (spameater_at_thisdomaindoesntexist.org)
Date: 11/08/04


Date: Mon, 08 Nov 2004 01:38:30 +0100

Hi,

This look pretty complicated :-)
Why don't you just store the DateTime directly in to Session?
Code is C#, but I think you get the idea...

store in session
****************

//store initial value:
Context.Session.Add("LastAccess", DateTime.Now);

get elapsed time
****************

//get time passed:
DateTime lastAccess = (DateTime)Session["LastAccess"];

//get the elapsed time
TimeSpan difference = DateTime.Now.Subtract(lastAccess);

hth, Philipp

TJS wrote:

> looking for example of timer function
>
> something that will help me get to track user's elapsed time since last
> refresh.
>
> tried this but not working with session values correctly in my class
>
> ================================================================
> Function NewText() As String
>
> Dim vString As String=" "
> Dim dtm As DateTime
> dtm = DateTime.Now()
>
> If context.session("ScreenTimer") is nothing Then
> context.session("ScreenTimer") = Hour(dtm) * 60 + Minute(dtm)
> else
> context.session("TimeElapsed") = Hour(dtm) * 60 + Minute(dtm) -
> cDBL(context.session("ScreenTimer"))
> end if
>
> If context.session("TimeElapsed") > 1 Then
> vString= "new text here"
> context.session("ScreenTimer") = Hour(dtm) * 60 + Minute(dtm)
> End If
> return vString
> End Function
>
>



Relevant Pages

  • timer function
    ... something that will help me get to track user's elapsed time since last ... refresh. ... tried this but not working with session values correctly in my class ... Dim dtm As DateTime ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Storing a datatable (or arraylist )on ASP.NET Session
    ... Perhaps your ArrayList store smth which can't be casted to object. ... If exactly that code u shown didn't work (emply arraylists) that I recomment to re-register asp.net 2.0 calling aspnet_regiis,exe - i ... Team blog: http://devkids.blogspot.com/ ... b> session variables is stored on web server's local sql database. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: LISP for web
    ... >>Ideas on how to store this information centrally for all of the app ... > ucw's form handling code (to make sure session ids are always ... > can deal with hardware failures an the app servers but this ...
    (comp.lang.lisp)
  • Re: Problem with asp.net app only allowing 1 user at a time
    ... from the client to the server), Application (an object that can store ... Now in your case you are reading and writing everything to the database, ... there is the Session object. ... To retrieve this you would do something like: ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: LISP for web
    ... > Ideas on how to store this information centrally for all of the app ... the risk of losing data and sessions if one of the machines goes ... ucw's form handling code (to make sure session ids are always ...
    (comp.lang.lisp)