HttpModule and file upload



Hi folks,
I wrote a HttpModule to handle file uploads (on beginRequest) prior to the
actual web form displaying the result.
The file upload processing generally works very well also for large files,
however it may fail for any unpredictable reason. If it fails I want to
invoke a context.response.redirect to the same url. This should result in a
simple GET request which passes my module without further attention.
I notice the following behavior:
1. I invoke the upload from the browser
2. The module intercepts the http POST, casts to a httpworkerprocess object
and calls GetKnownRequestHeader for the total length of the request
3. I cause an error within the module (intentionally), catch it NOT
processing any upload code
4. the context.response.redirect is executed
5. it takes a very long time (related to file size) until module is
revisited with the GET request
6. my page displays with the error caused before (this is correct)

Obviously, the file attachment has been uploaded to any memory location (?)
although I exited immediately and did not process my upload code. Ethereal
tells me that actually the file data has been completely uploaded to the

Can anyone explain how this can happen? Does access to any intrinsic
workerrequest object or the call to context.response.redirect mean that the
complete request including the file is (pre)loaded?

What I want is invoking the client redirect immediately on an error in my
HttpModule without loading the complete file attachment or the rest of it.


Thank you,


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question