I have a web service where end users will download ZIP archives, which can be very large (one test file over 200 MB). I would like to handle oversized files proactively and size-limited download crashes gracefully.
Since the web application will be deployed on client computers, I cannot easily ensure that the configuration matches any fixed size. I have documented how to use the appcmd command for them to set requestLimits.maxAllowedContentLength to outside of 30 MB by default.
But I would like to process it in a web application; I hope for two things:
To show the current limit on the page where they initiate the file download, something like lines:
Each file download is limited to 15 MB. If your archive is larger, (etc. etc. etc.)
To give a meaningful error when this size is exceeded. Currently, it takes a lot of time to send data, and then I see a misleading 404 page.
Any thoughts?
[change]
http://www.developer.com/db/article.php/10920_3426051_2/Limiting-Upload-Sizes-with-ASPNET.htm
I found this article, but although I can catch the error, I continue to get a reset connection in the browser Request.Redirect () or Context.RewritePath () , so it really is not better than 404. Hmm, actually this is with the server debugging VS2008, not with IIS.