Login  
Search All Forums
Dart Home | PowerWEB LiveControls for ASP.NET | Custom Development Reply | PowerWEB LiveControls for ASP.NET Topics | Forums   
AuthorForum: PowerWEB LiveControls for ASP.NET
Topic: Timer Control behavior
indecorum

From: Knoxville, TN USA
Posts: 13
Member Since: 04/27/06
posted February 9, 2007 12:08 PM

Since we've started using the LiveTimer control through several updates, we've experienced some flakey client behavior. We can't get any details, these reports come in from end users in the field who have no reason to give us honest feedback about what they were doing or what really happened. But it has happened enough that we are concerned.

The application uses a timer to countdown and then redirect the user to a timeout page. Once they visit a single page, they can't get back to it. What appears to be happening is the timeout code gets fired immediately, like the timer initializes and counts down all at once. We've never been able to duplicate this, but get reports on it happening almost weekly.

Does anybody have any thoughts on how I could resolve or debug this? Thanks!

John Talarico



From: Rome, NY USA
Posts: 630
Member Since: 06/01/05
posted February 9, 2007 1:45 PM

Which version of LiveControls are you using? Are your users working with any specific browser and version, or is it mixed?

Also, howare the redirects performed? Do you use a Response.Redirect or Server.Transfer within a callback?
indecorum

From: Knoxville, TN USA
Posts: 13
Member Since: 04/27/06
posted February 9, 2007 2:39 PM

We have many different clients including home users, people in hotels, people on corporate networks, etc. It is hard to control the client, including browser. So just about anything goes. Do to the nature of the app, it is easier for the user (and more advantageous!) to blame us than to admit to problems locally, so it is very hard to get specifics. If my code is bad, it'd be hard to know. Heh...

Anyway, we are currently on v1.1.4322, but this has been ongoing for the two or so years and through all the versions we've been using the product.

I'll post relevant code to show the whole process. If something is wrong with the code, that would be great! If you need clarification, let me know. A start/end time is set, the timer is started, and if the end time is hit the timer is supposed to redirect. It uses BufferedScript for the redirect, which was suggested in response to a previous post on the forum here. We have to use a long interval because using a 1 second interval makes the page hang and causes users to complain.


  Public iTimeoutSeconds As Integer
  Protected WithEvents LiveTimer1 As Dart.PowerWEB.LiveControls.LiveTimer
  Private bStopTest As Boolean = False


  Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

    If Not IsPostBack Then
      LoadSection()
      If iTimeoutSeconds > 0 And Not bStopTest Then
        If Not (IsDate(Session("EndTime"))) Then
          Session("EndTime") = Now.Add(New TimeSpan(0, 0, iTimeoutSeconds))
          Session("StartTime") = Now
        End If
        LiveTimer1.Blocking = True
        LiveTimer1.Interval = ConfigurationSettings.AppSettings("TimedTestTimerInterval")
        LiveTimer1.Start()
      End If
    End If
    MyBase.OnLoad(e)

  End Sub

  Private Sub LoadSection()
    Dim oSec As New Section

    oSec.LoadSection()
    iTimeoutSeconds = oSec.Seconds

  End Sub

  Private Sub LiveTimer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles LiveTimer1.Tick
    ' Stop the timer. The timer will only be restarted if the Auction is not over
    LiveTimer1.Stop()
    ' Determine how much time is remaining
    If Not IsDate(Session("EndTime")) Then Exit Sub
    Dim TimeLeft As TimeSpan
    Try
      TimeLeft = New TimeSpan(CDate(Session("EndTime")).Ticks - Now.Ticks)
    Catch ex As Exception
      Exit Sub
    End Try

    If TimeLeft.Ticks > 0 Then
      ' Set the time left LiveLabel
      LiveTimer1.BufferedScript.Write("window.status='" + TimeLeft.Hours.ToString("D2") + ":" + TimeLeft.Minutes.ToString("D2") + ":" + TimeLeft.Seconds.ToString("D2") + "';")
      ' Restart the Timer
      LiveTimer1.Start()
    Else
      If RecordAnswers(True, False) Then
        bStopTest = True
        Session("EndTime") = ""
        LiveTimer1.BufferedScript.Write("window.location='" & ConfigurationSettings.AppSettings("CurrentSiteSSLURL") & "multi_section_timeout.aspx';")
      End If
    End If
  End Sub
John Talarico



From: Rome, NY USA
Posts: 630
Member Since: 06/01/05
posted February 9, 2007 3:27 PM

I think the v1.1.4322 version is the .NET Framework (labeled Runtime Version), not the LiveControls version. If you're looking at the Reference properties in Visual Studio, it's the last field labeled Version.

As for the code, I'm not sure what could be causing the problem but it appears that you're firing .Stop() on every Tick event, and then .Start() when you want to proceed. It's best to reverse that logic and only fire Stop() when necessary, assuming that the timer will continue. This could prevent erroneous stop/start commands from being sent back to the client.
indecorum

From: Knoxville, TN USA
Posts: 13
Member Since: 04/27/06
posted February 9, 2007 3:30 PM

Woops...pasted from the wrong field. Our version is 1.5.4.0.

I got that stop/start from one of your examples. Thought it was weird, but went with it. So I'll give that a try, since it makes good sense! Thanks. Any other ideas?
jtrevino

From: Santa Monica, CA USA
Posts: 10
Member Since: 06/05/06
posted February 9, 2007 7:10 PM

Is there a conclusion to this post?
John Talarico



From: Rome, NY USA
Posts: 630
Member Since: 06/01/05
posted February 12, 2007 10:43 AM

Adrian - let us know if this resolved the issue. We haven't found any other possible cause.
indecorum

From: Knoxville, TN USA
Posts: 13
Member Since: 04/27/06
posted February 12, 2007 10:51 AM

I haven't published the update yet due to high volume of site usage. One published, it'll take awhile to know whether the update fixed it, but I'll post another message if it doesn't.
indecorum

From: Knoxville, TN USA
Posts: 13
Member Since: 04/27/06
posted March 5, 2007 10:21 PM

The problem continues. When it occurs, we are seeing two behaviors: either the timer does not work at all (lets the user continue even after time has expired) or it generates an error. I still cannot get any specific information about what the users are doing or their hardware/browser/connection information.

Can you think of anything client-side that would cause the timer (or its calls to the server) to fail? Can you think of anything I can do to test whether the timer will work before letting the user proceed into the timed area?

Thanks!
John Talarico



From: Rome, NY USA
Posts: 630
Member Since: 06/01/05
posted March 7, 2007 9:12 AM

Without having a way to reproduce the issue, it is difficult for us to determine what would be causing the Timer events to fail. The LiveTimer makes callbacks like other LiveControls and utilizes the standard JavaScript setTimeout() method to trigger callbacks from the client on the configured interval.
Reply | PowerWEB LiveControls for ASP.NET Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX