Asp.Net - Restricting File Upload Size Client Side
So the problem I encountered was that the site would throw an ugly "maxAllowedContentLength exceeded" error when a user would try to upload a file beyond a certain size. One of the difficulties with this is that the error is thrown before it even gets to an event, so you cannot try to handle it there. One solution that worked locally for me was to modify the web.config in two places, I will link that page below. Too bad for me that solution did not work on the server for some unknown reason. I had also tried handling it in the global.asax, but DNN, our CMS, is somehow preventing that from working. I will link that too below. So then I turned to a client side way of restricting it. The way the client side restriction works is that it uses a newer functionality of html5 that allows most browsers to get the file size. Older browsers will not work with this, but at this point I am fed up with this and DNN. Also if they disable Javascript they can upload files larger, b