Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args.set_errorHandled(true);
- public class CustomUserControl : UserControl
- {
- public new CustomUserControl
- {
- this.Error += new EventHandler(Page_Error);
- }
- protected void Page_Error(object source, EventArgs e)
- {
- Exception exception = HttpContext.Current.Server.GetLastError();
- // Message away
- }
- }
- protected void Application_Error(object sender, EventArgs e)
- {
- // fired when an unhandled error occurs within the application.
- // ..or use an HttpModule instead
- }
- public class UnhandledExceptionModule : IHttpModule
- {
- #region IHttpModule Members
- public void Dispose()
- {
- }
- public void Init(HttpApplication app)
- {
- app.Error += new EventHandler(app_Error);
- }
- protected void app_Error(object sender, EventArgs e)
- {
- HttpApplication app = sender as HttpApplication;
- Exception ex = app.Server.GetLastError().GetBaseException();
Add Comment
Please, Sign In to add comment