asp.net - Maximum Request Length Exceeded Not Redirect on Error Page -
i followed these links:
- catching "maximum request length exceeded" and
- asp.net - how show error page when uploading big file (maximum request length exceeded)?
to display error page handle uploading files exceeding maxrequestlength
in web.config
but problem is, not redirected error page (the message says webpage cannot displayed ). not know i'm missing.
here's code @ global.asax
:
void application_error(object sender, eventargs e) { if (ismaxrequestlengthexceeded(server.getlasterror())) { this.server.clearerror(); this.server.transfer("~/error.html"); } } private bool ismaxrequestlengthexceeded(exception ex) { exception main; httpunhandledexception unhandledex = (httpunhandledexception)ex; if (unhandledex != null && unhandledex.errorcode == -2147467259) { main = unhandledex.innerexception; } else { main = unhandledex; } httpexception httpexception = (httpexception)main; if (httpexception != null && httpexception.errorcode == -2147467259) { if (httpexception.stacktrace.contains("getentirerawcontent")) { return true; } } return false; }
and @ web.config
:
<httpruntime executiontimeout="1200" /> <customerrors defaultredirect="error.html" mode="on"> </customerrors>
it found out when maxrequestlength
not initialized, set default 4mb. (i didn't set because not important me.)
hope me this. thanks
i able find way solve maxrequestlength
error. found in link:
the solution posted comment rakesh kumar roy (post details: friday, february 13, 2009 1:43 pm). might helpful other programmers out there. :d
Comments
Post a Comment