Search code examples
asp.netsentry

How to log unhandled exceptions on sentry?


i just initialized sentry on my asp.net 4.5 project but i only see logs that i manually added to my project.

i am looking for exceptions that i did not handle them or did not foresee them. is there any special mistake that i have done using sentry?

i just added this line of code in Global.asax :

  var ravenClient = new RavenClient("https://appcode");

i see no exceptions or warnings on my sentry project except event i sent to sentry.


Solution

  • In ASP.NET, with Global.asax.cs you can override a method to handle errors:

            protected void Application_Error()
            {
                var exception = Server.GetLastError();
                ravenClient.CaptureException(exception);
            }