Last post Feb 25, 2014 06:22 AM by rstrahl
Jan 03, 2014 12:22 AM|lax4u|LINK
In our ASP.NET application, we have to provide download option for very large files ( 2GB+). So I created .aspx page and handle the downloading code in Page_Load event. When user clicks on HyperLink, it opens Download.aspx page and then the code downloads
the file chunk by chunk. No problem there. But then i thought i can do the same thing using HttpHandler.
I want suggestion whether i should do this funtionality using HttpHandler, Async HttpHandler or using good old aspx page. Note that since the application is developed using ASP.NET 4 i cannot use ASP.NET Web API.
Jan 08, 2014 06:46 AM|Ericzh|LINK
Hope below links help:
Feb 25, 2014 06:22 AM|rstrahl|LINK
It's not going to really matter which you use since the overhead and request time will be all in the handler returning your data to the client. Remember that ASPX pages *are handlers* (Page derives from IHttpHandler). HttpHandlers are more efficient, but
again, it's not going to matter when you're sitting on this request for a minute or two pushing file data to a client (it matters more for short quick requests to keep the resource usage down).
Not sure what you're sending down but if you really want to optimize the process of downloads consider using Response.TransmitFile, which offloads the file transmission to IIS which is much more efficient than ASP.NET in managing the resource while doing
transfers. However, this only works with files that exist on disk, so this may not be possible for you - if you need to chunk your content as it's dynamically created then using a handler, module or page is required.
Hope this helps,
+++ Rick ---