views:

366

answers:

2

If I upload a file that is larger than the configs max request length I get a "Server Response Error: Unknown Server Error" alert popup. It asks if I want to see the response page and if I click "OK" an application error window pops up saying "Maximum request length exceeded."

I found this already... http://stackoverflow.com/questions/665453/catching-maximum-request-length-exceeded

I was unsuccessful at getting that to work.

I also found another SO question (I can't seem to find it now) that was similar. The difference was that the OP had asked how to redirect to an error page. I don't want to do that. The answer was to use a custom error redirect that gets setup in the web.config.

I simply want to absorb the error and do nothing, I'm using the OnClientUploadError event to handle the error via js. Basically, I just don't want this stupid popup message.

One odd thing is that I don't see the error when running the app locally, but I do see the error when I've got the app deployed out to our server.

Note I should have mentioned that I know about the config value to set the max request length. Setting it to be very large won't work for this instance.

Update So, I'm wondering if this could be something with the IIS settings of our server. It's odd that it doesn't happen locally. Any ideas of what I should be looking for? Most of what I find on the net suggests modifying the machine.config. However, as I said before, I don't simply want to up the allowed size. I am handling the error fine via js, I don't want this alert to show up under any circumstances.

Update Well, it sounds like the IIS default limit is 30MB. The files I'm trying are much less than this. I'm at a loss...

A: 

Check for the value 4096 in Web.Config, under httpRuntime node. Increase it to 100mb or as desired. 4096 means 4mb.

Amit Ranjan
Thanks, but I already know about this value. I should have mentioned it. We have to keep the limit in place, we don't want to allow the user to upload a file that large. Besides, even if I set it to 500mb or a gig, if some random user decides to try something larger, they'll see the error.
Carter