Getting the Id of an error in Elmah after calling .Raise()

前端 未结 4 1751
悲&欢浪女
悲&欢浪女 2021-02-15 13:39

I\'m working on an MVC3 application and I\'m using Elmah to handle my error logging. What I want in my application is to carry the Elmah Id onto the custom error page as I will

4条回答
  •  终归单人心
    2021-02-15 14:06

    Maybe not very helpful but I suspect you can't get the error id at that point and you will need to use the logged event.

    When you call

    Elmah.ErrorSignal.FromCurrentContext().Raise(filterContext.Exception)
    

    You're just raising the error. Depending on how you've configured ELMAH you might be logging the error or you might just send an email or a tweet.

    There's no direct link between a raised error and an Id. That will only come with logging which, if you're feeling funny, you could be doing in multiple places and so creating multiple ids.

提交回复
热议问题