 |
 |
|
|
|
Error Handling by Container/Controller ASPX Pages
ASPX controller/container pages determine how to handle all application
errors and where to display the error messages. Each container page should
have a centralized place to handle the error and is responsible to determine
how each error should be handled.
The ASPX Page can use one of the following options for error handling:
- If an error is recoverable, the ASPX Page container should resend
the page to the user along with the error message. The error message
should always be displayed at the top of the page, and the .NET validation
mechanism should be used to display a validation summary at the bottom
of the banner. Implement the following steps:
- Drag a .NET summary validator to the ASPX Page container and position
it under the banner page. When the FnBannerUC.ascx control
is included in the in the ASPX Page, the summary validator is already
supplied.
- Define a custom validator in the user control and set the “IsValid”
property to be false whenever a recoverable error occurs. The validation
summary will then automatically pick it the error, no matter where
the custom validator is defined.
- Pages which inherit from FnBaseUC do not have to define the
custom validator. These pages can call the public function ShowErrorOnPage("errorstring")
and the error will be displayed below the banner when the page is submitted
or switched to via site navigation.
- If an error indicates that a certain operation or information is required,
the ASPX Page container should redirect the user to the corresponding
page to fulfill the requirements. For example, if the target library
is not logged on for a stored search, the search page redirects the
user to the Login page with Return URL pointing to itself.
- The ASPX Page container can display errors using the Error Page. The
HandleException function defined in the FnError object,
can be used to redirect the ASPX Page container to the Error Page. The
Error Page will then display the stack trace for each error using a
consistent format. If the Return URL is provided when the HandleException
function is called, the Error Page will be redirected back to the original
container page when the OK button is pressed. If a Return URL is not
provided, the Error Page will be transferred to the Home page when the
OK button is pressed.
|