Forum Moderators: open

Message Too Old, No Replies

ASP timers

         

danath

4:00 pm on Dec 28, 2003 (gmt 0)

10+ Year Member



Hello

i've gotta a problem with making one of the procedures to self-restart after specific amount of time (e.g. 1 minute).
so far i've used javascript's setTimeout function, but i need something that will work on server side.

Thanks for help and happy hollidays

IanTurner

5:53 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



If you use totally server side - you won't know whether the visitor has left the page.

Can you explain what you are trying to do?

GaryK

6:34 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here I go again, taking a risk by perhaps showing my ignorance but here's how I do essentially what you seem to be doing.

For starters, read this tutorial [w3schools.com] from W3Schools on how to detect if a user is still connected.

There is a free ActiveX component called WaitFor [serverobjects.com] from ServerObjects that lets you pause the processing until some specific event has occurred such as having waited one minute. Within the loop for WaitFor you can check to see if the user is still connected and take whatever action you need to based on that knowledge.

EDIT: Where are my manners? That was your first post and you should have gotten a great big Welcome to WW!

danath

6:57 pm on Dec 28, 2003 (gmt 0)

10+ Year Member



it has nothing to do with users connected. i need to send some emails at exact time. so i thought to make a procedure, that's checking time every minute-interval and if the time is correct, send emails.
if i implement it with javascript, procedure won't start unless there's at least one person online, get it?
so i need something that will run on server and check time every minute or so....

thanks, bye

GaryK

7:23 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Someone correct me if I'm wrong but wouldn't using the Task Scheduler to execute an ASP page once a minute be the easiest solution? I'm not sure if it's the most efficient method though.

danath

7:30 pm on Dec 28, 2003 (gmt 0)

10+ Year Member



thanks gary.:) sometime the easiest solution is hardest to find:)

IanTurner

7:39 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I use task scheduler for that sort of task too. I haven't found any reliability problems.

danath

7:48 pm on Dec 28, 2003 (gmt 0)

10+ Year Member



yeah, but the thing is that you can't schedule it on a minute basis
so any other suggestions?

GaryK

7:49 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>thanks gary.

You're more than welcome. I'm glad I provided some useful advice and that someone like Ian has confirmed it is indeed a viable option. :)

GaryK

8:03 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What version of Windows are you using? In Win2K Professional there is an Advanced button on the Schedule tab. That will let you repeat the task as often as once a minute. I'm sure the same functionality exists in other versions of Windows.

danath

8:45 pm on Dec 28, 2003 (gmt 0)

10+ Year Member



yes i got that:)

if i select in scheduler to run *.asp it opens it in my text editor. how am i supposed to run it like an server page?

GaryK

8:52 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you using a fully qualified URL as the program to run or just the filename? If you use just the filename it will tend to open FrontPage or whatever editor you might have associated with .asp files. As a fully qualified URL it will cause your default browser to open and navigate to the URL which is what you want to happen.

IanTurner

9:47 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I use the wget command line http utility for calling asp files via the task scheduler. You should be able to find a copy by searching on 'wget'

GaryK

10:40 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For his use wget would be perfect!

Please let me add a slightly off-topic comment. For internal use wget is fine. Personally, and for the thousands of websites that use my browscap.ini file and global.asa code, wget is treated as a "website stripper" and will usually be redirected to a dead-end page or worse. ;)

IanTurner

11:40 pm on Dec 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Agree - the safest uses of wget are local on the server.