Take the 2-minute tour ×

I have some users in my web site that have a task with a deadline. I want to email them when their deadline is finish. but this action must be perform automatically. Is there any way to make something like that? should i use global in asp, or there is a better way?

share|improve this question
What are you using as your datasource? If your only trigger is a deadline passing, you should probably be considering a scheduled job that runs from your database. –  MTAdmin Dec 11 '12 at 22:31
I store my deadlines as a datetime parameter in sql. –  Saeed Talaee Dec 11 '12 at 22:43
add comment

1 Answer

up vote 1 down vote accepted

You really should write either a scheduled task or a Windows service to perform that sort of action. An ASP.NET website will happily go to sleep if there are no requests, and you really don't want to have long running threads on a web server.

(There is a 'trick' using cache expiration to get scheduled callbacks to your code, try it if you can't use the options below.)

Write an endpoint (URL like /CheckTaskDeadline.ashx) that when called will check for task deadlines and trigger an action (send email). Add a scheduled task that makes a request for the endpoint every 5 minutes, or every hour (whatever granularity you need for reliably triggering close to the deadline). Use curl or wget to 'ping' the URL.

If you don't have access to the machine, sometimes you can create scheduled tasks using your webhost's configuration panel. If you don't, ask them nicely :-). A good hosting service provider should be able to help you. Otherwise, consider moving the application to another host, or get a separate 'ping' service, like Pingdom.

share|improve this answer
thank you... but how can i do that by using my host... can you explain more or give me a document about that? –  Saeed Talaee Dec 11 '12 at 22:42
Depends on your host and the control panel they offer (e.g. Plesk or WebPanel, or ...). Send them an email to ask if it can be done. –  michielvoo Dec 11 '12 at 22:44
add comment

Your Answer


