AjaxWithWebService.MvcApplication.Application_EndRequest C# (CSharp) Method

Application_EndRequest() protected method

protected Application_EndRequest ( ) : void
return void
        protected void Application_EndRequest()
        {
            // Handling error conditions...
            // Inspiration: http://stackoverflow.com/a/9026907 

            var code = Context.Response.StatusCode;

            // Add more conditions here as you need them
            if (code == 404) { this.HandleError("NotFound"); }
            //if (code >= 500) { this.HandleError("ServerError"); }
        }