I work just on ASP classic (I know I've to learn something new, but for now...) and that's my problem:
In my database I store website's account. After a year the accounts needs to be deactivated. I've create a function that's works fine, but I need a sheduled call (every night at 00.00 am). Is it possibile? Do I need to put the call on global.asa?
thanks a lot!
Maurizio
If you have access to the server, create a vbscript (.vbs) and setup the Task Scheduler...
This is what we use for database tidy routines and for nightly backups.
You can schedule jobs through free cron services such as https://www.setcronjob.com with configuration like in following picture. This is a good solution for hosting customers who do not have permission to create the task, I used many times with no trouble. The service will request to url you specified at you specified timespan or exact time.
For a little bit security / avoiding unnecessary requests you could specify a custom hash for the will be requested page.
If Request.QueryString("hash") = "somespecialstuffs" Then
'Do Job
End If
if you don't have access to the servers, as a work-around you can do the following... Create a task in your server (anything that runs 24 hours), and that task will just visit your site to a specific ASP page with a parameter that instructs it to do the update, so create an ASP file that reads the parameter and runs the update.
The problem with putting it in global.asa is that, if your site is not constantly in use, IIS could stop the application process after some time (think the default in IIS is like 30 minutes), so you're not guaranteed that the application process will be up to run the update.
来源:https://stackoverflow.com/questions/11561965/asp-classic-how-to-schedule-a-function-server-side