Ext.Net.DirectRequestModule.Application_Error C# (CSharp) Method

Application_Error() public method

public Application_Error ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        void Application_Error(object sender, EventArgs e)
        {
            HttpApplication app = sender as HttpApplication;
            HttpContext context = app.Context;

            if (RequestManager.HasXHeader(context.Request))
            {
                DirectResponse responseObject = new DirectResponse(true);
                string error = null;

                if (HttpContext.Current != null)
                {
                    error = HttpContext.Current.Error != null ? HttpContext.Current.Error.ToString() : null;    
                }
                
                if (!ResourceManager.AjaxSuccess || error.IsNotEmpty())
                {
                    responseObject.Success = false;

                    if (error.IsNotEmpty())
                    {
                        responseObject.ErrorMessage = error;
                    }
                    else
                    {
                        responseObject.ErrorMessage = ResourceManager.AjaxErrorMessage;
                    }
                }

                app.Context.Response.Clear();
                app.Context.Response.ClearContent();
                app.Context.Response.ClearHeaders();
                app.Context.Response.StatusCode = (int)HttpStatusCode.OK;
                app.Context.Response.Write(responseObject.ToString());
                app.Context.Response.End();
                app.CompleteRequest();
            }
        }