Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Perotti 53 posts 94 karma points
    Mar 18, 2014 @ 14:23
    Alex Perotti
    0

    Error Handling

    I'm trying to add a custom error handler that should fire every time there is an application error

    namespace LogService
    

    { public class ErrorHandling : ApplicationEventHandler {

        protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
    
            umbracoApplication.Error += new EventHandler(umbracoApplication_Error);
    
        }
    
        void umbracoApplication_Error(object sender, EventArgs e)
        {
    
            Exception ex = HttpContext.Current.Server.GetLastError().GetBaseException();
            EmailProvider.SendErrorEmail(ex);
            HttpContext.Current.Response.Redirect("~/");
        }
    }
    

    }

    The event is binded (the code is executed on start) but the event doesn't fire...

    Umbraco version 6.1.6

    PS: I' don't want to change global.asax inherit class if possible (this meant to be part of a pluggable package)

    Thank you

  • Amir 75 posts 224 karma points
    Mar 18, 2014 @ 15:01
    Amir
    0

    I had same problem while ago and searched everywhere but did not find a solution apart from changing the Global.asax.

    Btw, you can inherit a class (in your case Global.asax) from more than one classes or interfaces,

  • Alex Perotti 53 posts 94 karma points
    Mar 18, 2014 @ 15:18
    Alex Perotti
    0

    "Btw, you can inherit a class (in your case Global.asax) from more than one classes or interfaces"

    I don't get this point.

    My goal is to attach the event in an indipendent way, so another developer doesn't have to care about it. If I change the inherit class in global.asax this will not be compatible with third party indipendet changes.

Please Sign in or register to post replies

Write your reply to:

Draft