Application error after trying to 'Save & Return' when attachment is too large
When creating a new issue, if the attachment is too large and the user clicks 'Save & Return', BugNet does not save the issue and returns "Application Error -
as a follow up, here's the detailed error log
Maximum request length exceeded. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Maximum request length exceeded.] System.Web.HttpRequest.GetEntireRawContent() +12703549 System.Web.HttpRequest.GetMultipartContent() +221 System.Web.HttpRequest.FillInFormCollection() +357 System.Web.HttpRequest.EnsureForm() +110 System.Web.HttpRequest.get_HasForm() +12705935 System.Web.UI.Page.GetCollectionBasedOnMethod(Boolean dontReturnNull) +146 System.Web.UI.Page.DeterminePostBackMode() +129 System.Web.UI.<ProcessRequestMainAsync>d__14.MoveNext() +1304
You can fix this by changing the max request length value in the web.config to accept larger file uploads
<system.web>
<httpRuntime maxRequestLength="X" />
</system.web>
The maxRequestLength is measured in kilobytes.
We don't want to change the max attachment size. Besides, the error will happen again whenever anyone attaches something larger than the new max size.
This is true, and why we show the error page if this happens.
I would think the error would be handled a bit better and have a message appear on the screen similar to when a required field is left empty, as opposed to having the application crash with no message saying that the attachment is too large...it just displays "Application Error - /Issues/CreateIssue/1"...nothing that says the attachment is too large. Also, if you click the 'Save' button instead of the 'Save & Return' button, there it no error at all. The issue is created but the attachement is not saved. Again, no message letting the user know the attachment is too large, but at least it doesn't abort the application :-/
ASP.NET doesn't provide a nice way to handle this error. There are hacks but nothing really solid that I have seen.
at the least couldn't the issue be created and the application crash avoided, as when the 'Save' button is clicked?