HttpHandlers and HttpModules
HttpHandler or HttpModule for file upload, large files, progress indi...
Re: HttpHandler or HttpModule for file upload, large files, progress...
View Complete Thread
Re: HttpHandler or HttpModule for file upload, large files, progress indicator?
May 30, 2003 08:09 AM
Cyberfloatie/ups101, Have you (or anyone else) been able to prevent uploading of files larger than a certain size? Before I buffer the incoming entity body, I do a check on the "content_length" similar to the code that Bjorn.B provided on the 20th of December. If the content_length is greater than a certain size, the idea is to stop to remainder of the incoming request and redirect the user off to a page that informs them that the file they are uploading is too big. Whenever I attempt to do the redirection to another page or URL (using HttpApplication.Context.Response.Redirect(...), HttpApplication.Response.Redirect(...) or even something like ....Response.End()) I receive a DNS error in the browser. Sure enough, the file upload is ceased, however I would like to be able to alert the user to the fact they are attempting to upload a file that is too big. I have thought about HttpHandlers, however I would tend to think that by the time the Handler processes the request, the request has already been fully uploaded. I have a feeling that because the HTTPModule is attempting to redirect the request while the request is still being sent by the user, that it gets confused and "spits the dummy". Has anybody had a similar problem to this, or have any suggestions as to what direction I should be heading? The reason I need to do this is to prevent unnecessary data being transferred to our server (and hence any related download charges). Thanks, Paul.