How to do async tasks and show updates on the page?

J

jaffarkazi

Hi
I have a page that is going to send a number of emails that will be
fetched from the database. This is on a hosted server, so I don't have
any background automatic way of sending mail. (If anyone can make a
suggestion for this, that would be good too).

There may be 2 mails or 100 mails. I'm not particularly interested
that the page will timeout or not.
The tasks will basically be:
1. Pick up the emails from the database.
2. Start sending the emails one by one and update the status of each
mail as SENT (the updating may be a batch job).
3. At regular intervals, I want the page/display to be updated with
how many mails are done, and how many are left.

I was referring to the following articles:
http://www.eggheadcafe.com/articles/20060918.asp
http://msdn.microsoft.com/en-us/magazine/cc163725(printer).aspx
http://msdn.microsoft.com/en-us/magazine/cc164128(printer).aspx

and found the eggheadcafe solution to be the most simple for the
actual processing. But there is nothing for the actual display update.

Any help on this would be appreciated.

Thanks and regards,
--Jaffar
 
B

bruce barker

none of these are relevant to what you are trying to do. they describe
how to call a page async, or how to do aync processing on the page. you
want to google for progress bar and long running tasks.

the general approach is on the starting page to create a background
thread that does the email, and writes its progress to a database or
file. the page the refreshes itself (or uses ajax) and polls to check
the status. you can use the .net thread pool to create the thread.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top