by Sajid Rehman
Feedback
|
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days):
31900/
45
|
|
|
How do I do it? Error handling |
Error handling features can be provided in your Page Template by –
- Including an ErrorCode property in your PageTemplate class.
- Add a method SetErrorCode(int code) that sets the above property & redirects to your error page. This method can be called from the code-behind when an error/exception is encountered.
- Your error page would then be able to retrieve the error code by
int errorCode = ((PageTemplate)Context.Handler).ErrorCode;
This error code can be used to retrieve the appropriate error message from the resource file.
Advantages
- Ensures that all developers in the team handle errors/exceptions consistently – thereby saving time during integration.
- Ensures that redirection to an error page, error logging, & error display happen in exactly the same way across pages & developers.
|
|
|
User Comments
No comments posted yet.
|
Product Spotlight
|
|