ASP.NET script "planning" question

I am looking for a way to run the script every day at 5am to delete the contents of the Temp folder. The following is the method that I am considering. I would appreciate any thoughts on this or suggestions on other methods. I want to save everything locally, so that external accounts will not be outside of my ASP hosting account at a discount.

  • Enter a text file containing the date and time of the next required launch (tomorrow 5:00).
  • Specify the value of the Datetime cache expiring after (one hour?)
  • When someone gets to the website and the cache expired, reload the datetime into the cache
  • If Datetime has passed, run the script as "scheduled" and add 24 hours in DateTime to the file

Your comments are appreciated.

+3
source share
3 answers

You are on the right track. Here's a good article on how to achieve this.

Also, based on your comment, why not use a session event to clear? In addition, just in case, you can connect to the end of the application.

+4
source

You can also create a web service to complete the task, and then schedule the task periodically to the web service.

+1
source

, , , .

- - ( ) , , .

To do this, you must use the scheduled task. If you do not, then you should have some other process that sends the event to the site (perhaps output a web method), which is according to the desired schedule.

+1
source

Source: https://habr.com/ru/post/1705586/


All Articles