Enables HTTP Error Handlers.
This property enables the use of error code handlers to control how to respond when an application error or exception occurs.
When errors occur, the user shouldn't have to read technical error details which they cannot understand; instead, a friendly page that tells them what happened should be displayed. Also, proper handling of errors is recommended to hide sensitive technical information that can be exploited.
Enable this property (environment level) and associate an HTTP Error Code to a File previously uploaded to the KB as a File object (using a plain HTML file is recommended). Typically, you might configure the following kind of errors:
- 401: Unauthorized.
- 404: Page not found.
- 405: Method not allowed. A request was made of a page using a request method not supported by that page.
- 408: Timeout. Server timed out.
- 500: Internal Server Error.
When using the C# generator, valid values are between 400 and 999 inclusive; otherwise, the following error will be displayed:
The 'statusCode' attribute is invalid. Integer value must be between 400 and 999 inclusive.
In general, Java Application servers such as Tomcat will directly handle the 400 (Bad Request) error and it will not be delegated to the web application.
Not implemented in the NetCore generator.
This property applies only at design-time.
Create a 404.html file with the following content and upload it to the KB; set the extraction location path for your generators.
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>404 Error - Page Not Found</title>
<h1>Sorry, the page you requested was not found.</h1>
Configure this property to bind the 404 HTTP error code to the 404.html file.
With this declaration, if any 404 error occurs, your own error page is displayed to the user.
Note that your custom error page is relative to the web application’s context root.
To apply the corresponding changes when the property value is configured, execute a Build All.
This property is available since GeneXus 16 Upgrade 11.