I use a 1×1 image tag to implement tracking on my website. The src attribute of the image tag is a call to a custom asp.net handler that I’ve written.
This handler inserts some data to the database. It gets millions of hits a day so I need the database insert to be async.
I’ve never done multithreaded programming so am seeking some assistance on how to go about this.
My handler should invoke a new thread which inserts data to the database and immediately return the 1×1 image to the client.
If the database insert is slow, the handler should not wait till it is finished but immediately return the image to the client.
Thanks
You can look at following links for good understanding of various ways to implement async processing and related code examples:
http://msdn.microsoft.com/en-us/library/ms227433.aspx
http://msdn.microsoft.com/en-us/magazine/cc164128.aspx
http://msdn.microsoft.com/en-us/magazine/cc163463.aspx
http://www.codeproject.com/KB/aspnet/AsyncBLOB.aspx
http://blogs.msdn.com/b/tmarq/archive/2010/04/14/performing-asynchronous-work-or-tasks-in-asp-net-applications.aspx