Wednesday, February 16, 2011

Common Development task - Firing events to send em...

Was asked in a forum recently...

Automatic event fire in Asp.net? I want to fire an event in my asp.net application on specific time.

For ex:- I want to send email to my clients on 8 Am (every day).
How can i do this?




I have done this recently there are 2 options that I recently used
1) Have an scheduledTasks.aspx page which has the functionality of sending mail on page load based on a parameter. And then schedule task using windows task scheduler in the web server. Benefits - If the app server is not running also it will still start the app pool and send your mail.

2) Use SQL server Database mailing facility as you can generate the html directly using a stored procedure so nothing to do in the app and then you can schedule it in the job tasks...

Both these options will not fail even if your application is not running...where as other approaches might not work when your app pool is not running because of no calls or something else

1 comment:

  1. Another point to add is this approach is very useful when you host in a shared environment.

    ReplyDelete