A newer version of this page is available. Switch to the current version.

Handle a Callback Exception on the Server Side

Use the static CallbackError event to handle a callback exception thrown by a DevExpress web control on the server side.

Delegate callback exception handling to the Application_Error event handler.

void Application_Start(object sender, EventArgs e) { 
    DevExpress.Web.ASPxWebControl.CallbackError += Application_Error;
} 

In the Application_Error event handler, you can use the GetLastError() method to get the last exception’s details.

void Application_Error(object sender, EventArgs e) { 
    // Use HttpContext.Current to get a Web request processing helper 
    HttpServerUtility server = HttpContext.Current.Server; 
    Exception exception = server.GetLastError(); 
    // Log an exception 
    AddToLog(exception.Message, exception.StackTrace); 
}

View Example: How to handle app level errors occurred inside ASP.NET WebForms controls during callbacks