Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred during callback processing

$
0
0

Normally, you use the Application_Error event handler, implemented in a Web Application project's Global.asax file, to handle all application-level errors. Prior to v2010.2, errors occurred on callback events of DevExpress ASP.NET controls were not handled via the Application_Error event handler. Now, you can assign Application_Error as an event handler of the ASPxWebControl.CallbackError static event, to handle exceptions thrown in callbacks. To accomplish this, add the following code to your Global.asax file:


[C#]
voidApplication_Start(objectsender,EventArgse){// Assign Application_Error as a callback error handlerASPxWebControl.CallbackError+=newEventHandler(Application_Error);}

To get exception details and log them, use the following code within the Application_Error event handler:


[C#]
voidApplication_Error(objectsender,EventArgse){// ...// Use HttpContext.Current to get a Web request processing helperHttpServerUtilityserver=HttpContext.Current.Server;Exceptionexception=server.GetLastError();// Log an exceptionAddToLog(exception.Message,exception.StackTrace);}
Example Comments

Added By: okan sarıca at: 7/13/2012 5:21:38 AM    

i handle the exception in global asax but how can i send message to callbackcontrol for example ? if i throw a new exception in global asax e.message in callbackError function is 'some error occured'


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>