← All platforms

ASP.NET error tracking

Your ASP.NET app doesn’t have to be brand new to get useful error reports. The Sentry integration sends its exceptions to Telebugs on your server.

~/hoofnotes  dotnet add package Sentry.AspNet
~/hoofnotes  nvim Global.asax.cs
using System;
using System.Web;
using Sentry;
using Sentry.AspNet;
public class MvcApplication : HttpApplication
{
private IDisposable _sentry;
protected void Application_Start()
{
_sentry = SentrySdk.Init(options =>
{
// Copy the complete DSN, key and path included.
options.Dsn = "YOUR_TELEBUGS_DSN";
options.AddAspNet();
});
}
protected void Application_Error() => Server.CaptureLastError();
protected void Application_End() => _sentry?.Dispose();
}
~/hoofnotes  msbuild HoofNotes.sln

Space pauses or resumes. R replays. Escape shows the complete setup.

Hang on, I already use Sentry

Keep Sentry.AspNet and change its destination to your Telebugs DSN. Your error reports stay on your server. You don’t need a Sentry account.

Is this for System.Web applications?

Yes. The ASP.NET integration connects to the application’s error lifecycle. It can report request exceptions from an existing .NET Framework web app.

What if my app uses ASP.NET Core?

Use the ASP.NET Core integration instead. The hosting model is different, but both send error reports to your Telebugs server.