Skip to main content

Redirect a Response on a Callback Exception

When a callback exception occurs, you can redirect the application to another web resource in the following ways:

  • Use the Web.config’s callbackErrorRedirectUrl option to specify a page where the response is redirected.

    <configuration>
      <!-- ... -->
      <devExpress>
        <!-- ... -->
        <errors callbackErrorRedirectUrl="~/Error.aspx" />
      </devExpress>
    </configuration>
    
  • Use the static CallbackError event to delegate callback exception handling to the Application_Error event handler. In the handler, call the RedirectOnCallback(String) method to redirect the application to another web resource.

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

On the redirection page, you can call the static GetCallbackErrorMessage() method to obtain exception-related information.

public partial class Error : Page {
    protected void Page_Load(object sender, EventArgs e) {
        string errorMessage = ASPxWebControl.GetCallbackErrorMessage();
        Response.Output.Write(errorMessage);
    }
}
See Also