ASP (not .NET) server-side timer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StuckOnWords
    New Member
    • Sep 2007
    • 8

    ASP (not .NET) server-side timer

    My goal:
    I need to cause my web application to check for updates on a remote website twice a week around a certain time. The routine would download the xml content of a given page, parse it, and retrieve information for use on my website. So I need to trigger the routine which does this on a scheduled interval.
    It seems to me I need a timer that is initiated from the global.asa. I really don't care if it runs every 5 minutes or so (that's not a lot of server load) and checks the time, and if the day of the week and time are appropriate, the routine should get triggered and the remote website can be checked for the updated information I need.
    I have seen "system.tim e" available for the .NET folks, but I'm trying to steer clear of .NET for a zillion reasons. Suffice it to say I'm using the old ASP and intend to keep it that way. Any ideas how I can accomplish what I need?
    Thanks all.
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    You can use setTimeout function to set the timer.
    Syntax for doing this is :
    ID = window.setTimeo ut("yourRoutine " , 5000)
    This function will execute your subroutine after specified no of milliseconds.
    To clear the timer if you do not want to execute the subroutine you can call
    window.clearTim eout ID

    Originally posted by StuckOnWords
    My goal:
    I need to cause my web application to check for updates on a remote website twice a week around a certain time. The routine would download the xml content of a given page, parse it, and retrieve information for use on my website. So I need to trigger the routine which does this on a scheduled interval.
    It seems to me I need a timer that is initiated from the global.asa. I really don't care if it runs every 5 minutes or so (that's not a lot of server load) and checks the time, and if the day of the week and time are appropriate, the routine should get triggered and the remote website can be checked for the updated information I need.
    I have seen "system.tim e" available for the .NET folks, but I'm trying to steer clear of .NET for a zillion reasons. Suffice it to say I'm using the old ASP and intend to keep it that way. Any ideas how I can accomplish what I need?
    Thanks all.

    Comment

    • StuckOnWords
      New Member
      • Sep 2007
      • 8

      #3
      Originally posted by shweta123
      Hi,

      You can use setTimeout function to set the timer.
      Syntax for doing this is :
      ID = window.setTimeo ut("yourRoutine " , 5000)
      This function will execute your subroutine after specified no of milliseconds.
      To clear the timer if you do not want to execute the subroutine you can call
      window.clearTim eout ID
      window.setTimeo ut? That's a function to be used on a webpage with a window, right? How does that help me in an Application function? I can't use something like that in global.asa I don't believe. Am I wrong about that? I don't think I would run a routine like I described in my initial posting using something like this because nobody would be opening a window; it needs to be run automatically by the website application.

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        Unfortunately, classic ASP only runs when pages are being loaded, so there is no way to set application timers. The best solution in ASP is for every page load, check whether it is the first load after a given time. If so, perform your task and reset the timer, otherwise continue.

        Let me know if this helps.

        Jared

        Comment

        • StuckOnWords
          New Member
          • Sep 2007
          • 8

          #5
          Originally posted by jhardman
          Unfortunately, classic ASP only runs when pages are being loaded, so there is no way to set application timers. The best solution in ASP is for every page load, check whether it is the first load after a given time. If so, perform your task and reset the timer, otherwise continue.

          Let me know if this helps.

          Jared
          Thanks for your effort, Jared. To be honest...no, it really doesn't help. The updates need to occur whether someone has visited the site or not, and cannot be reliant upon being triggered by a visitor. I had considered writing a program for a separate computer to simply visit the site on a regular basis to trigger just such a function, but then the site is again reliant upon outside sources in order to function, which will never do. I guess I'll just have to put the thinking cap back on.

          For the record, I apologize for not responding sooner to your responses. I'm used to sites sending email notification when someone responds to a thread, and I'd been a bit preoccupied to think to check here sooner without a reminder. Thanks for your input.

          Comment

          • shweta123
            Recognized Expert Contributor
            • Nov 2006
            • 692

            #6
            Hi,

            You can use some third party activex control or the easy way is to create your own activex control using VB where you can have the facility to set the timer interval and it will fire the events at the time interval set. You will be able to trigger your routine in this interval. You can do this in Global.asax also.
            I can help you in its coding if you want.

            Comment

            • StuckOnWords
              New Member
              • Sep 2007
              • 8

              #7
              Originally posted by shweta123
              Hi,

              You can use some third party activex control or the easy way is to create your own activex control using VB where you can have the facility to set the timer interval and it will fire the events at the time interval set. You will be able to trigger your routine in this interval. You can do this in Global.asax also.
              I can help you in its coding if you want.
              Hi Shweta,

              Well that sure sounds like what I'd need. I admit that I wouldn't know how to do it. I am somewhat proficient in VB6, but creating an activeX is a bit more than I've ever tried. I'd certainly love some coaching in it. Umm...Global.as ax refers to .NET, doesn't it?

              Thanks for sticking with me on this. I'm feeling more pressure every day to come up with a solution.

              StuckOnWords

              Comment

              • jhardman
                Recognized Expert Specialist
                • Jan 2007
                • 3405

                #8
                Originally posted by StuckOnWords
                ... Umm...Global.as ax refers to .NET, doesn't it?
                the "classic" ASP equivalent is called "global.asa "

                Comment

                • StuckOnWords
                  New Member
                  • Sep 2007
                  • 8

                  #9
                  Originally posted by jhardman
                  the "classic" ASP equivalent is called "global.asa "
                  Right. I guess I was just wanting to ensure that whatever Shweta had in mind would be able to be implemented in classic asp as well as the .net versions.

                  Comment

                  • peh803
                    New Member
                    • Jan 2008
                    • 1

                    #10
                    Can you just write a vbscript task and schedule it to run in windows task manager? I have used this technique in many legacy MS environments to automate processes..

                    HTH,
                    Phil

                    Comment

                    • StuckOnWords
                      New Member
                      • Sep 2007
                      • 8

                      #11
                      I'm guessing you mean Windows Task Scheduler? The thing is, my site is hosted by an outside sourse. I don't have the option of setting up a scheduled item within the server operating system.

                      Comment

                      • ilearneditonline
                        Recognized Expert New Member
                        • Jul 2007
                        • 130

                        #12
                        Originally posted by StuckOnWords
                        I'm guessing you mean Windows Task Scheduler? The thing is, my site is hosted by an outside sourse. I don't have the option of setting up a scheduled item within the server operating system.
                        Alot of hosting providers allow you to set up cron jobs. Are you positive yours does not allow it??

                        Comment

                        • StuckOnWords
                          New Member
                          • Sep 2007
                          • 8

                          #13
                          Originally posted by ilearneditonlin e
                          Alot of hosting providers allow you to set up cron jobs. Are you positive yours does not allow it??
                          It never even occurred to me to ask them. I'll look into it. Thanks.

                          Comment

                          Working...