Timer in the web application on servre site.

Discussion in 'ASP .Net' started by Vasil Buraliev, Nov 8, 2003.

  1. Would you tell me please is it posible to make some code somewhere in web
    application where this code will be called or started after some time?
    For example.
    I wanna my web applicaiton to check let's say every12 hours which day it is
    on the web server than let's say if it's monday... to do somehing.

    Is it possible with some technologi or somehow somewhere insite web
    application?

    best regards.
    Vasil
     
    Vasil Buraliev, Nov 8, 2003
    #1
    1. Advertising

  2. ASP.NET pages aren't designed to be used this way.
    Instead I'd suggest creating a Windows Service.
    Here's more information on Windows Services:
    http://msdn.microsoft.com/library/d...nvssamp/html/vbcs_CreatingaWindowsService.asp

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



    "Vasil Buraliev" <> wrote in message
    news:...
    > Would you tell me please is it posible to make some code somewhere in web
    > application where this code will be called or started after some time?
    > For example.
    > I wanna my web applicaiton to check let's say every12 hours which day it

    is
    > on the web server than let's say if it's monday... to do somehing.
    >
    > Is it possible with some technologi or somehow somewhere insite web
    > application?
    >
    > best regards.
    > Vasil
    >
    >
     
    Steve C. Orr [MVP, MCSD], Nov 9, 2003
    #2
    1. Advertising

  3. Vasil Buraliev

    -=Chris=- Guest

    I've seen situations where it's beneficial to do what Vasil wants to do.
    For example, if you pay for a web host, and you only have access to run web
    pages, but not local programs and services, then you can't go the service
    route. Rather than look at it as a timer related programming challenge,
    perhaps it would be better to simply flag which dates the required action
    has been performed on, and simply check the status each time the page is
    loaded.

    I was minding my own business when Steve C. Orr [MVP, MCSD] blurted out:

    > ASP.NET pages aren't designed to be used this way.
    > Instead I'd suggest creating a Windows Service.
    > Here's more information on Windows Services:
    >

    http://msdn.microsoft.com/library/d...nvssamp/html/vbcs_CreatingaWindowsService.asp
    >
    >
    > "Vasil Buraliev" <> wrote in message
    > news:...
    >> Would you tell me please is it posible to make some code somewhere in web
    >> application where this code will be called or started after some time?
    >> For example.
    >> I wanna my web applicaiton to check let's say every12 hours which day it

    > is
    >> on the web server than let's say if it's monday... to do somehing.
    >>
    >> Is it possible with some technologi or somehow somewhere insite web
    >> application?
    >>
    >> best regards.
    >> Vasil


    --
    Insert corny line here
     
    -=Chris=-, Nov 9, 2003
    #3
  4. Vasil Buraliev

    Jj Guest

    You can do this by starting a new Thread in a static block in a class.

    Here is how you do it.
    1. create a static constructor in a "Manager" class (or add it in any class
    you prefer) -- this guarentees that the following thread only get created
    once (when you first reference this class.)
    2. In that static constructor create a new thread and let it do whatever you
    want every 12 hours (using a loop and sleep method)
    3. In your web application, refer to this class (by either instantiate the
    Manager class or just reference it)


    Jianjun

    "Vasil Buraliev" <> wrote in message
    news:...
    > Would you tell me please is it posible to make some code somewhere in web
    > application where this code will be called or started after some time?
    > For example.
    > I wanna my web applicaiton to check let's say every12 hours which day it

    is
    > on the web server than let's say if it's monday... to do somehing.
    >
    > Is it possible with some technologi or somehow somewhere insite web
    > application?
    >
    > best regards.
    > Vasil
    >
    >
     
    Jj, Nov 9, 2003
    #4
  5. This sounds very interesting. I will try this. Thanks for your idea Jianjun,
    and thank you all you guys for your reply.

    regards.
    Vasil

    "Jj" <> wrote in message
    news:...
    > You can do this by starting a new Thread in a static block in a class.
    >
    > Here is how you do it.
    > 1. create a static constructor in a "Manager" class (or add it in any

    class
    > you prefer) -- this guarentees that the following thread only get created
    > once (when you first reference this class.)
    > 2. In that static constructor create a new thread and let it do whatever

    you
    > want every 12 hours (using a loop and sleep method)
    > 3. In your web application, refer to this class (by either instantiate the
    > Manager class or just reference it)
    >
    >
    > Jianjun
    >
    > "Vasil Buraliev" <> wrote in message
    > news:...
    > > Would you tell me please is it posible to make some code somewhere in

    web
    > > application where this code will be called or started after some time?
    > > For example.
    > > I wanna my web applicaiton to check let's say every12 hours which day it

    > is
    > > on the web server than let's say if it's monday... to do somehing.
    > >
    > > Is it possible with some technologi or somehow somewhere insite web
    > > application?
    > >
    > > best regards.
    > > Vasil
    > >
    > >

    >
    >
     
    Vasil Buraliev, Nov 9, 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. Kelsang Wangchuk

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

    Kelsang Wangchuk, Jul 31, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    719
    Kelsang Wangchuk
    Jul 31, 2003
  2. Replies:
    1
    Views:
    1,615
    Steve C. Orr [MVP, MCSD]
    Feb 22, 2005
  3. Simon

    page timer, or redirect timer

    Simon, Nov 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    11,214
    Bruce Barker
    Nov 4, 2005
  4. Kevin Humphreys
    Replies:
    2
    Views:
    367
    Gozirra
    Nov 29, 2006
  5. Leo Violette
    Replies:
    0
    Views:
    1,055
    Leo Violette
    Apr 17, 2009
Loading...

Share This Page