asp.net - Displaying a meaningfull error when uploading too large a file -
We have set a fixed limit on the file uploads to our site - the settings under the default asp.net and iis sizes .
I have a simple grip setup in the application_BeginRequest that catches it (it is not excited because it checks content content including all other form data but it is quite good). I want to either start processing the page on which the user tried to upload or the fallback scheme was redirected to a page, explaining that the filesyase was too big (before us This is a subtitle, but you know users - they do not have to read any stinky subtitles').
So what's the problem? It seems that my response was already sent to the user - stating a 404 that the page was not found. I do not want this behavior, I want to flush this reaction, because it is not the user I want to see - I want to show something else - Create my own feedback, redirect or process that page which they Wanted to get it anyway.
I think the problem can still dismiss the IIS request / post because the file is larger than the IIS. I really dig - a crazy user is trying to upload a 20mm picture, the IIS should not be taken to the knees, but what is this? Or does the user get the chance to block this reaction - instead of maximizing the maximum size on IIS, instead of spending the bandwidth on getting this file, I want to recognize this post as being 'too big' and Want to send an irrelevant response back to the user?
I had this problem and after many searches no one seems right at the point where you can find IIS The ASP.net service will serve error, the maximum request length can be set to set on it. You can also catch this error at Global.assx and can show a more friendly error page to the user.
You can find more information on doing this here
Comments
Post a Comment