Welcome to Professional ASP.NET - Chris Love's Official Blog Sign in | Join | Help

Chris Love's Official ASP.NET Blog

Chris Love's Helpful tips, tricks and pragmatic development knowledge for the ASP.NET world.
Add to Technorati Favorites


ASP Insider Follow Me On Twitter
Leveraging httpHandlers to Stream Custom Content in ASP.NET

WROX released my custom httpHandler eBook, Leveraging httpHandlers to Stream Custom Content in ASP.NET,  late last week. It is the second part of two WROX BLOX I recently authored, the first being about custom httpModules. The main purpose of the two eBooks is to expose ASP.NET developers to how ASP.NET functions at the root. Custom modules give you the ability to hook into the processing pipeline to execute any custom logic. Custom handlers allow you to control every piece of content that is served by the ASP.NET engine to the client.

Cover image for product 0470379405Custom httpHandlers are a key concept eventually every ASP.NET developer needs to understand and start to leverage. Nothing is actually served from ASP.NET without a custom handler being responsible for it, even static content.

In this eBook I walk through several examples of custom httpHandlers and give the reader some potential real world handlers to get started with. I also try to expose the reader to key concepts they need to be cognizant to understand how to control how the request is processed on the client. Some of these concepts involve understanding the HTTP protocol, others explain MIME types. I also touch on a little about controlling how content is cached.

The examples I demonstrate in the book are:

  • A Simple httpHandler
  • An RSS Feed
  • A vCard handler
  • An Image Resizer and Cropper
  • A PDF Handler
  • A Stock Quote handler
  • Returning a Zip Compressed Document

The eBook is priced at an affordable $6.99 and available for immediate download.

Share this post :
Posted: Sunday, June 15, 2008 2:02 PM

by Chris Love
Filed under: ,

Comments

Speednet said:

Hi Chris, Will you/Wrox be releasing your two books for the Kindle? They did not appear to be available.
# June 16, 2008 9:28 AM

Chris Love said:

Honestly I do not know. That is a question for WROX to answer. My guess is probably not because Amazon seems to have a tight lock on what is on the kindle according to editors I talked to at TechEd a few weeks ago.

# June 16, 2008 9:34 AM

Speednet said:

OK, Chris, thanks for letting me know. Seems like a strange attitude for Amazon to take (keeping a tight lock on kindle content) since the founder's message states that he wants every book ever made to be available for it. I love the Kindle, but I hope they do more to get their entire selection of computer books on it, especially niche books like these two. I'l contact Wrox to see if they are planning to put them on the Kindle.
# June 17, 2008 10:11 AM

Guy Harwood said:

Have purchased both this and the other one you wrote on modules. Very thorough, handy and a good read on the train home :-)
# June 19, 2008 11:58 AM

Anthony Grace said:

Chris, What exactly does the PDF Handler do? I'm looking to force all PDFs to open in a new browser dynamically... Anthony :-)
# July 23, 2009 7:08 PM

Taliesin said:

Its tricky to server pdf files from an http handler. Adobe Reader in "Allow fast web view" mode starts downloading a pdf and soon as it has enough bytes to display the first page it aborts the connection to the web server, and displays the first page. Then it makes a "multipart/byteranges" request to retrieve the rest of the document. This is what causes most download scripts to fail when serving pdf content. For an implementation that supports this check out: http://code.google.com/p/talifun-web/wiki/StaticFileHandler If you are looking for sample implementations of http handlers and http modules. Check out: http://code.google.com/p/talifun-web/ StaticFileHandler An http handler that will serve static files in a cached, compressed and resumable manner. It generates consistent etags and the correct meta tags for caching on proxies and locally. This is especially useful when you don't have control over the configuration of the webserver. It can also serve cached requests and compressed cached requests from memory bypassing the hard drive. It supports the following http header tags: * Accept-Ranges * ETag * Expires * Last-Modified * Range * If-Range * If-Match * If-None-Match * If-Modified-Since * If-Unmodified-Since * Unless-Modified-Since CrusherModule A module that compresses js into a single file, and css into a single file. It also watches for changes to any of the watched css or js files and regenerates the crushed file. It generates a unique hash for the crushed file and appends it to the css url and the js url. So you are always sure to be served the correct content, regardless of caching. CssSpriteModule A module that combines component images into a single sprite image file and generates the css sprite file required to cut the sprite image into its component images. RegexUrlAuthorizationModule A module that provides authorization based on urls matching regular expressions. LogUrlModule A very simple module that makes it easy to hook into web requests that match a regular expression. PageCompressionModule A module to compresses dynamic pages for webforms and mvc. WebResourceCompressionModule A module to compresses web resources for webforms and mvc.
# March 19, 2010 5:55 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS