locked
HttpHandler or aspx to download large file RRS feed

  • Question

  • User-209105085 posted

    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.

    Friday, January 3, 2014 12:22 AM

All replies

  • User1622957740 posted

    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 ---

    Tuesday, February 25, 2014 6:22 AM