start at specifed time

  • Thread starter Thread starter Darko Bazulj
  • Start date Start date
D

Darko Bazulj

Hi,

Is it possible to start some code at specifed time(like scheduled task)?
How to achive that?
I can't use windows service or windows shedule task. I don't have necessary
rights.
I would appreciate if someone has an example or link, anything to point me
in the right direction.

Thank you for help.

Regards,
Darko Bazulj
 
You can use a Timer control on a form and set the interval on 5000 (5 secs)
and add a new eventhandler for the tick... Or you can create an instance of
the System.Timers.Timer class

You can read this article:
http://www.devdex.com/gurus/code/575.asp

Gabriel Lozano-Morán
Software Engineer
Sogeti
 
Thanks for Gabriel's informative suggestions.

Hi Darko,

I think Gabriel's suggestion on using a Timer is good. Also, the article
Gabriel provided seems discussing on desktop application scenario, as for
asp.net web application, that's a bit different from desktop application
when using Timer object. ASP.NET application is request/response based
which dosn't as persistent connection between client and server. So after a
certain page's execution lifecycle (render response to client), the page
object at serverside will be disposed. So if we will use Timer at
serverside, don't create it as local variable in page
class (as member or local variable in function). We can use the following
means to hold the reference to the Timer:
1. Use a certain class's static member which will be global to all the
classes in your application( if not using webfarm ).

2. Use the asp.net's Application Cache or ApplicationState to store the
reference of the Timer you created

In addition to using Timer, we can also create a background thread in
asp.net which constantly check some schedule tasks. The thread's reference
can also be held through the means I mentioned above.

If there are anything unclear, please feel free to post here. Hope helps.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top