Sitecore Blog: @sitecorejohn blog

Error Management with the Sitecore ASP.NET CMS

By John West, September 07, 2011 | Rating:  | Comments (1)

This blog post provides an overview of options for managing exceptions and errors using the Sitecore ASP.NET.

A Sitecore solution includes at least the following levels of management for different types of errors, and in general errors bubble up in the following order:

  • Exception management for individual presentation components, including layouts (try/catch blocks and error handlers). For more information about exception management with Sitecore, see the Presentation Component API Cookbook on the Sitecore Developer Network (SDN). For information about trapping exceptions in sublayouts, see my blog post Trap Sublayout Exceptions in the Sitecore ASP.NET CMS.
  • Exception management at application level (global.asax). For more information about exception management at the application level, see the section How to Trap Application Exceptions in the Presentation Component API Cookbook on SDN.
  • Sitecore error management. Sitecore error management only applies to HTTP requests handled by Sitecore, which handles most of the requests that IIS handles with ASP.NET. For more information about Sitecore error pages, see the Sitecore Error Pages section of the Guide to Handling HTTP 404 on SDN.  Sitecore handles errors at the end of the httpRequestBegin pipeline, and in the media request handler. In both cases, Sitecore uses either the System.Web.HttpContext.Current.Server.Transfer() method or the System.Web.HttpContext.Current.Response.Redirect() method depending on the value of the RequestErrors.UseServerSideRedirect setting in the web.config file.
  • ASP.NET error management, which only applies to HTTP requests that IIS handles with ASP.NET, but which Sitecore does not handle, or possibly in the case of an error in Sitecore. For more information about ASP.NET exception management, see the ASP.NET Exception Management section of the Presentation Component API Cookbook on SDN.
  • IIS error management, which only applies to HTTP requests that IIS does not handle with ASP.NET, or possibly in the case of an error in Sitecore or ASP.NET. The specifics vary depending on your version of IIS, but in IIS 7, this you can configure these settings through the Error Pages command.

You can implement additional levels of "error" management. For example, some HTTP 404 conditions may not indicate errors; you could implement an httpRequestBegin pipeline after the default ItemResolver to set the context item item according to custom logic if it is null. For an example of a similar processor, see the NotFoundSearchResolver example in the PageNotFound Sitecore Shared Source project. For more information about pipelines, see my blog post All About Pipelines in the Sitecore ASP.NET CMS.

Tags: API, Architecture, Infrastructure

Comments

  • http://sitecoreblog.blogspot.com/2011/10/crash-iis-event-5011-and-how-to-add.html

    - John West
    October 13, 2011 at 9:30 AM

*
*
*

Learn More with Sitecore

Newsletter
*

Loopbaan | Read Case Study >

As a highly marketing-oriented company we have many advantages in using Sitecore because we can schedule multiple online marketing campaigns at the same time. Sitecore helps us to fully service our clients.

- Annemarie van Duynhoven, CEO, Loopbaan BV