473,654 Members | 3,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

timers

I am new to asp. I tried implementing a timer in a System.Web.UI.P age
derived class to perform periodic refreshes of the interface and calls to a
web service but it does not seem to work as I expected. I could not set its
SynchronizingOb ject field.

When the page first loads I see that the timer has been operating for 2 or 3
seconds already (it updates the text field of a label control), but whenever
I perform other refreshes of the interface it does not seem to be working
properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...

Nov 18 '05 #1
3 1420
Stephen McCrea wrote:
I am new to asp. I tried implementing a timer in a System.Web.UI.P age
derived class to perform periodic refreshes of the interface and calls to
a web service but it does not seem to work as I expected. I could not set
its SynchronizingOb ject field.

When the page first loads I see that the timer has been operating for 2 or
3 seconds already (it updates the text field of a label control), but
whenever I perform other refreshes of the interface it does not seem to be
working properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...


Hello Stephen,

It's not possible to use timers like this, at least not if you're
using the web forms framework with ASP.NET. As soon as your page
object has finished the "render" phase ( sent its output as a
response back to the client ), your page object will be destroyed.
Next request from the client, a new instance will be created again.
In this scenario, the only way to refresh the client periodically
is by using some client side JavaScript.

If you don't use the web forms framework, you can keep the response
stream open and periodically send JavaScript to the client which
contains instructions to update the user interface. In this scenario,
you do have to watch out for timeouts, f.i. there may be limits
to the amount of time a web browser will wait for a response
to finish and there may be limits to the amount of time an
aspx may run on the server. Also, I believe this doesn't
work correctly in all browsers, because some browsers
only begin executing JavaScript when they received
the complete response.

Best regards,

Eric
Nov 18 '05 #2
Server side timers aren't much good with ASP.NET pages because they only
exist long enough for the HTML to be generated and sent to the client
(usually a few milliseconds.)
Therefore you'll probably find a client side timer more useful, which
executes in the user's browser and therefore keeps going as long as the page
is open in the user's browser.

Here's an example for you:
http://www.crowes.f9.co.uk/Javascript/timer.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Stephen McCrea" <sm*****@mccrea engineering.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I am new to asp. I tried implementing a timer in a System.Web.UI.P age
derived class to perform periodic refreshes of the interface and calls to a web service but it does not seem to work as I expected. I could not set its SynchronizingOb ject field.

When the page first loads I see that the timer has been operating for 2 or 3 seconds already (it updates the text field of a label control), but whenever I perform other refreshes of the interface it does not seem to be working
properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...


Nov 18 '05 #3
Server side timers aren't much good with ASP.NET pages because they only
exist long enough for the HTML to be generated and sent to the client
(usually a few milliseconds.)
Therefore you'll probably find a client side timer more useful, which
executes in the user's browser and therefore keeps going as long as the page
is open in the user's browser.

Here's an example for you:
http://www.crowes.f9.co.uk/Javascript/timer.htm

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Stephen McCrea" <sm*****@mccrea engineering.com > wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. ..
I am new to asp. I tried implementing a timer in a System.Web.UI.P age
derived class to perform periodic refreshes of the interface and calls to a web service but it does not seem to work as I expected. I could not set its SynchronizingOb ject field.

When the page first loads I see that the timer has been operating for 2 or 3 seconds already (it updates the text field of a label control), but whenever I perform other refreshes of the interface it does not seem to be working
properly - it no longer updates the label.

Could someone help me or point me to a good reference online or hardcopy?

Thank you...


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
371
by: GDumencu | last post by:
I have a C# program that have to run all the time. For some reasons I cannot make it a service. This program has 3 timers and by time to time ( days or weeks) one of them stops. Some times, starts working again after several hours. Each timer records a message to a file at the beginning and at the end of each timer. I can see the last message from that timer and than nothing.
0
1762
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they just stop functioning one-by-one. Here is detailed explanation. I run application on 2 dedicated Win 2003 servers. Server A serves about 1000 active simultaneous users (150-200 aspx page requests per second), Sever B serves about 400 users (80-100...
0
1755
by: Cider123 | last post by:
I was originally using: System.Windows.Forms.Timer It started to lock my Window Service up, so I went to the next evolution: System.Threading.Timer All was good. I was using it to send a message once a minute (to
3
2192
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My issue is simply getting timers to work. I have a DatabaseManager.DataManagerFacade which contains a timer. Every 6 seconds it updates stock data using an online webservice. I wrote have 2 possible startup projects to make the service work. One...
3
2030
by: Jeff Greenland | last post by:
Hello everyone, I am having problems with Timers in a web application. They just seem to stop running after 15 minutes or so. My web application is set up like this: When a user hits a page in the site, that page (.aspx) instantiates a compiled class (.DLL). The instantiation process creates a Timer that runs in the background to perform tasks every so often (such as notifying clients
9
7862
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I might need to carry out some back-end processing without pausing the individual users' Session while that process runs. E.g. I might provide the ability for a user to upload a text file of job
10
2697
by: WhiteSocksGuy | last post by:
Help! I am new to Visual Basic .Net (version 2002) and I am trying to get a System.Timers.Timer to work for me to display a splash screen for about two seconds and then load the main form. I have two forms (frmSplash and frmMain) and a code Module setup as my startup object. Here is the code that I have, when I try to run this part of the splash screen form shows and then program terminates. What am I doing wrong? Thanks,
5
9874
by: Michael C# | last post by:
Hi all, I set up a System.Timers.Time in my app. The code basically just updates the screen, but since the processing performed is so CPU-intensive, I wanted to make sure it gets updated regularly; like every 1.5 secs. or so. I only ran into one issue - the MyTimer_Elapsed event handler was not updating the screen correctly all the time, often leaving large chunks of the screen un-painted for several seconds. On a whim I decided to...
1
1826
by: | last post by:
Frustrated.. (I have seen other posts regarding this problem with no resolution..) I am using dotnet 1.1 with latest SP on a Win2KP box (actually 2 boxes), have even run the service on WinXP SP2 box.. I have created a service to grab data off a receive socket (small packets), place in a queue (Queue class), and do an insert into SQL. I have 3 timers in my project. One checks the status of the sql service every 15 seconds, one checks the...
1
3037
by: Jonathan Woods | last post by:
Hi there, I have three methods these need to execute at every interval time. I would like to know which option is better? Option A) Three System.Timers.Timer objects these execute each method. timer1.Elapsed += new System.Timers.ElapsedEventHandler(Method1_Elapsed);
0
8707
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8482
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6161
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.