Handling exception Maximum request length exceeded
Hi,
I'm new to this forum so not sure if this is the correct place to put this question. So if it isn't, please point me to the correct place to post it.
I am having an issue with large file upload. I keep getting the YSOD (Yellow Screen Of Death) with the message "Maximum request length exceeded". I know I can increase the maxRequestLength in web.config to handle bigger file size. I also know the trick to increase maxAllowedContentLength (if needed to be) on IIS7. HOWEVER, I do not want to keep on increasing the limit. I want to handle the exception myself.
All the page I had found so far with google relating this is to do it in global.ascx (Application_Error). Since I don't have access to that file on Umbraco, how can I do it? Is there a way of doing this already on Umbraco that I'm unaware of?
You can set the request lenght to something like 1GB and the timeout to 1 hour (although I know you don't want to).
BUT also use a client upload tool (like ajaxuploader) that checks the file size on the client's computer before even trying to upload, so your webserver resources don't get tied up.
Handling exception Maximum request length exceeded
Hi,
I'm new to this forum so not sure if this is the correct place to put this question. So if it isn't, please point me to the correct place to post it.
I am having an issue with large file upload. I keep getting the YSOD (Yellow Screen Of Death) with the message "Maximum request length exceeded". I know I can increase the maxRequestLength in web.config to handle bigger file size. I also know the trick to increase maxAllowedContentLength (if needed to be) on IIS7. HOWEVER, I do not want to keep on increasing the limit. I want to handle the exception myself.
All the page I had found so far with google relating this is to do it in global.ascx (Application_Error). Since I don't have access to that file on Umbraco, how can I do it? Is there a way of doing this already on Umbraco that I'm unaware of?
You need to modify the maxRequestLength in the httpRuntime tag in the web.config to allow larger files.
Change it to something like this:
my bad.. sometimes I respond before i finish ready the entire post... hmm
Instead of using the global.asax file you can use a HTTPHandler
Cheers,
Richard
Hi Richard,
Could you please elaborate that a bit? I have never use a HTTPHandler to catch an exception before and don't really understand the logic here.
Regards,
Ken
Here's some documentation on the subject: http://msdn.microsoft.com/en-us/library/bb398986.aspx
Create a class and implement the IHttpModule interface.
You need to register the handler using 1 of 2 ways:
You need to reference Microsoft.Web.Infrastructure.dll for the second method. (Details here: http://odetocode.com/blogs/scott/archive/2011/02/27/dynamicmoduleutility.aspx)
Hi,
You can set the request lenght to something like 1GB and the timeout to 1 hour (although I know you don't want to).
BUT also use a client upload tool (like ajaxuploader) that checks the file size on the client's computer before even trying to upload, so your webserver resources don't get tied up.
An example of an error logging HTTPModule (with log4net): http://codebetter.com/karlseguin/2006/06/12/global-asax-use-httpmodules-instead/
Rgds,
David#
Hi,
An implementation of an HttpModule to handle the MaxRequestLength error can be found here:
http://our.umbraco.org/forum/core/general/6704-How-to-implement-custom-error-page-after-exceeding-httpRuntime-maxRequestLength
Regards,
John
is working on a reply...