Suppose someone:
- visits and ASPX page (http get request).
- sets a "too large" file in a file uploader and clicks the upload button (http post request).
I don't care to have a custom error page served; that's dumb, and disrupts the application.
I want to HANDLE the error programmatically. It can be intercepted (after the entire request has been received, I think) by the Application_BeginRequest handler of global.asax, as posted here.
What I'd like to do is remove the oversized file from the request, set some kind of flag in something like "HttpContext.Current.Items["filetoolarge"] = true", then do a Server.Transfer to the same page, so that the request runs as though the file was never sent, except now there's this error flag that the page would of course check and display a nice error message when found.
Can this be done?