WebProWire.com
TechnologySearchAdvertisingSocialFinancialLegal
Latest News on: WebProWire.com

News flash: Steve Jobs is aging The Unofficial Apple...
A Japanese school uses Nintendo DS SlashGear
Dell Grabs Top Spot in Open... I4U News
Wine marketing goes high-tech CNNMoney.com
Are You Happy With Your HP 2710p? GottaBeMobile


Web News

Bus conductor's son develops software for accountants
A bus conductor's son in Punjab has developed software to enable chartered accountants (CAs) to prepare balance sheets in the Indian rupee format of lakhs and crores, as against the internationally prevalent...

AT&T may buy Maxis' 74 pct in India's Aircel-paper
Top U.S. phone company AT&T Inc is close to buying Malaysia's Maxis Communications' 74 percent stake in Indian mobile operator Aircel, the Economic Times...

Virtusa recognised best US tech co in India
Virtusa Corporation has been recognised as the best US technology, communications and entertainment company in India by the Indo-American Chamber of Commerce (IACC), the only bi-lateral chamber for Indo-US...


06.30.08

Using The IHttpAsyncHandler In ASP.NET

By Mads Kristensen

I've known about the IHttpAsyncHandler interface for a long time, but never really had the time to play around with it.

After a brief web search I realized that not many people have. There are no easy to understand articles or blog posts on the subject, so I thought I'd investigate and share.

Basically, the IHttpAsyncHandler interface allows you to serve content asynchronously from a HTTP handler. This is great when you need to free up the worker thread to do processing like IO work etc. ASP.NET actually uses fewer threads when it runs asynchronously, which is great for performance and scalability. That's because each thread is returned much faster to the thread pool.

The IHttpAsyncHandler is very similar to IHttpHandler interface, but with two extra methods to override - BeginProcessRequest and EndProcessRequest. From there you invoke a delegate to handle the processing asynchronously. It sounds complicated, but it really isn't. Here is an example that removes the complicated stuff and gives you one single method to modify.

The code

The example is a handler that is used to serve files for download. Serving a file requires IO access and therefore it is a great candidate for asynchronous serving. As you can see, the ServeContent method is all there is needed for the specific task of serving files. Just modify it to whatever purpose you find fit.




Continue reading this article.

About the Author:
Copyright Mike Moran

Mads Kristensen currently works as a Senior Developer at Traceworks located in Copenhagen, Denmark. Mads graduated from Copenhagen Technical Academy with a multimedia degree in 2003, but has been a professional developer since 2000. His main focus is on ASP.NET but is responsible for Winforms, Windows- and web services in his daily work as well. A true .NET developer with great passion for the simple solution.

http://www.madskristensen.dk/
About DevWebPro India
DevWebPro India is for professional developers ... those who build and manage applications and sophisticated websites. DevWebPro India delivers via news and expert advice New Strategies In Development.





DevWebPro India is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com NetworkNewz.com





-- DevWebPro India is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2008 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article


New Strategies In Development DevWebPro India News Archives About Us Feedback DevWebPro India Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact