Application able to record error in OnError, but we are not able to do any redirect or so to show something meaningfull to user. Any ideas? I know that we can set maxRequestLength in web.config, but anyway user can exceed this limit and some normal error need to be displayed.
Clear your Constant Contact cookies to fix the Request Entity Too Large error. Occasionally when navigating your account, you might see an error message that reads "Request Entity Too Large." When this happens, it means that your Constant Contact cookies have built up and need to be cleared.
HttpRuntime maxRequestLength ASP.NET has its own setting to limit the size of uploads and requests. Use the maxRequestLength of the httpRuntime element. The default size is 4096 kilobytes (4 MB). Max value 2,147,483,647 kilobytes (~82 Terabyte).
Description. maxAllowedContentLength. Optional uint attribute. Specifies the maximum length of content in a request, in bytes. The default value is 30000000 , which is approximately 28.6MB.
The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded." Server Error in '/' Application.
As you say you can setup maxRequestLength in your web.config (overriding the default 4MB of your machine.config) and if this limits is exceeded you usually get a HTTP 401.1 error.
In order to handle a generic HTTP error at application level you can setup a CustomError section in your web.config within the system.web section:
<system.web>
<customErrors mode=On defaultRedirect=yourCustomErrorPage.aspx />
</system.web>
Everytime the error is showed the user will be redirected to your custom error page.
If you want a specialized page for each error you can do something like:
<system.web>
<customErrors mode="On" defaultRedirect="yourCustomErrorPage.aspx">
<error statusCode="404" redirect="PageNotFound.aspx" />
</customErrors>
</system.web>
And so on.
Alternatively you could edit the CustomErrors tab of your virtual directory properties from IIS to point to your error handling pages of choice.
The above doesn't seem to work for 401.x errors - this code-project article explains a workaround for a what seems to be a very similar problem: Redirecting to custom 401 page
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With