ASP.NET - Scheduled Tasks in ASP.NET - Asked By Naresh Kumar on 16-Feb-11 02:32 AM

Hi All,

I need to send emails with required information received from database on Scheduled Tasks(every 3hours) using ASP.NET.

This application needs to run on Hosted services.

Can any one have suggestions.

Thanks in advance.
Jatin Prajapati replied to Naresh Kumar on 16-Feb-11 03:12 AM
Hi Naresh,
It is good to write a windows service for this type of scheduled task. In ASP.NET you don't have any provision that you get it done after every interval. Also, for this if you want it on ASP.NET then you can use AJAX timer, and you have to keep that page open in web browser. So, I advice you to write a windows server for this.
Reena Jain replied to Naresh Kumar on 16-Feb-11 03:57 AM

All of my tasks (which need to be scheduled) for a website are kept within the website and called from a special page. I then wrote a simple Windows service which calls this page every so often. Once the page runs it returns a value. If I know there is more work to be done, I run the page again, right away, otherwise I run it in a little while. This has worked really well for me and keeps all my task logic with the web code. Before writing the simple Windows service, I used Windows scheduler to call the page every x minutes.
but In a shared host environment you're out of luck for windows services and executables.  Dedicated this isn't a problem... A timer in isn't a good solution either unless you can ensure that it is fault tolerant.If you don't have access to a dedicated server, then your best bet is to write a small .NET command line utility which calls executes an HttpWebRequest against your website.

here are two good links for you

hope this will help you