Posts

Showing posts from July, 2016

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

Bootstrap Modal Popup is Grayed Out

The popup shows up, but after it pops up the whole page becomes unusable.  So not only was it not displaying right, the whole page is frozen.  I found a StackOverflow post, below describing how the popup may have that behavior when it is nested inside elements that have positioning elements, which fits with previous experiences I have had.  One of the answers described how appending the modal popup to the body of the page  "$('#mytModal').appendTo('body');" would be a way of getting it out of any positioning elements.  Previously on a different page I had moved it out of some divs and it worked right.  However in this particular site the modal is in a ASP.Net site as a user control where the "offending" positioning element is in the master page and it contains the user control.  I stuck the script in the user control, but the behavior was the same.  When I used Firebug I saw that I was getting a "$ is not defined" message. With Jquery we ne