Last post Mar 03, 2011 12:37 AM by nullableCode
Feb 09, 2011 04:24 AM|wannabe.wpf.dev|LINK
Hi all. This is my first post here.
I am having a specific requirement of which I am not sure it is even possible to do but I have read somewhere in the past few days that similar to what I am trying to achieve shoud be done by writing a custom HttpHandler (or module?).
Basically, I currently have a simple aspx page that accepts a file upload and forwards it to another URL (after doing some checking). The way this currently works is that my Page_Loaded gets called only after the entire file is uploaded.
What I am looking to achieve is get a hold of an uploaded file Stream early on as soon as request headers are processed so I could do some sort of piping froim the uploaded file Stream to my destination Stream. With large files this should be extra beneficial
because there is no waiting time for the large file to get uploaded and my gut feeling tells me this way the memory footprint should also be lower.
What I need is a forward-only Stream. No seeking needed. Therefore, I don't need to manage the entire uploaded file at some point in time. I just want to send the bytes as soon as they are received (with some lightweight processing in between).
Unfortuantely, I am not knowledgable enough so I am seeking help and advice. Is this scenario at all possible? Is HttpHandler a friend of mine here?
Mar 03, 2011 12:37 AM|nullableCode|LINK
I have an article on my site that explains how to stream data using Handlers.
File Buffering and Streaming
The first 1/2 of article [b] explains how to pipe data from the Client to the Handler. Is doesnt matter what type of client, it should apply similarly.
The 2nd 1/2 of the article is where you will find the explanation on how to process the data in the Handler.
Hope this helps!