I would like to know, which is the best way to handle "maximum request length exceeded" error in my application. I have asp.net application in which the user is allowed to upload file(pdf or image). I would like to handle the error. I did some research and found that it can be handled in global.asax, but I am not sure about what has to be done. As far as I understood, I will have to handle it in global.asax file and redirect it to custom error page. Could anyone please suggest what and how the custom error page should be?
Should it be a HTML page or a jpg file or aspx file? And what should be its content? Can I redirect it to the same page on which error occurred? If yes then it would be easier for me to just display an error message on the same page.
Update I did client side validations to restrict users from uploading large file. But still would like to how can the issue be fixed at server side.
The error can be handled in
Global.asax: Application_Error()
as so: