ASP time delay script

I thought I would post this function I wrote to do a simple time delay on an ASP script. It’s pretty straight forward.

Sub Pause(intSeconds)
startTime = Time()
Do Until DateDiff(“s”, startTime, Time(), 0, 0) > intSeconds
End Sub

Call Function:

Now before you start complaining, I know this is not a great solution. There can be resource issues on your server, because all this function does is loop. With that being said, there are certain cases where this script can come in handy. Some outgoing mail servers require a short delay between emails to prevent spam. I used this script on a credit card processing program I wrote. If the merchant company failed to respond to my authorization request the script would pause for 5 seconds before trying again. I would try 5 times before dumping to an error message.


Enjoy this post? Be sure to subscribe to my RSS feed and my WordPress Tips and Tricks Newsletter! Also check out my WordPress books: Professional WordPress Third Edition & Professional WordPress Plugin Development


  1. One more great job done,
    thank you very much brad 3 cheers for u 🙂

  2. Hi,

    Im stuck also with asp, and cant find solution for something like this.

    But i need inside loop to stop for 1 minutes if counter is 200, and then continue with loop.
    How to achive this?


  3. I wouldn’t use this type of script for a pause that long. This is for short delays of no more than a few seconds.

  4. You can also use the free WaitFor 1.0 which can be found at last time I was there the download was slooooow. it might be available elsewhere on the web. The problem os pausing with a loop is that cpu cycles peg and other work gets shafted til yor pause is over. In I hear you can play a silent .wav file in the bacground for a period of time to pause and it won’t take resources to do. not sure about doing that in though.

  5. I’m also looking for something to pause the asp script… I don’t want to use the cpu for that because I need to pause a few thousands times for the duration of .05 seconds each time.

  6. Works great for me, just what I needed, many thanks.