# ASP.NET Error Tracking and Performance Monitoring

> Get insights you can act on with ASP.NET application monitoring. Learn how you can easily diagnose, fix, & optimize performance while tracking errors here.

**URL:** https://sentry.io/for/aspnet/

---

**Documentation:** [https://docs.sentry.io/platforms/dotnet/guides/aspnet/](https://docs.sentry.io/platforms/dotnet/guides/aspnet/)

## Install

Add the Sentry dependency:

```powershell
Install-Package Sentry.AspNet
```

You configure the SDK in the `Global.asax.cs`:

```csharp
using System;
using System.Web;
using Sentry;
using Sentry.AspNet;
using Sentry.EntityFramework; // if you also installed Sentry.EntityFramework
using Sentry.Extensibility;

public class MvcApplication : HttpApplication
{
    private IDisposable _sentry;

    protected void Application_Start()
    {
        // Initialize Sentry to capture AppDomain unhandled exceptions and more.
        _sentry = SentrySdk.Init(options =>
        {
            options.Dsn = "https://<key>@sentry.io/<project>";
            // When configuring for the first time, to see what the SDK is doing:
            options.Debug = true;
            // Set TracesSampleRate to 1.0 to capture 100%
            // of transactions for tracing.
            // We recommend adjusting this value in production.
            options.TracesSampleRate = 1.0;
            // if you also installed the Sentry.EntityFramework package
            options.AddEntityFramework();
            options.AddAspNet();
        });
    }

    // Global error catcher
    protected void Application_Error() => Server.CaptureLastError();

    protected void Application_BeginRequest()
    {
        Context.StartSentryTransaction();
    }

    protected void Application_EndRequest()
    {
        Context.FinishSentryTransaction();
    }

    protected void Application_End()
    {
        // Flushes out events before shutting down.
        _sentry?.Dispose();
    }
}
```

See the [ASP.NET docs](https://docs.sentry.io/platforms/dotnet/guides/aspnet/) for full setup options.

## Features

### ASP.NET Error Monitoring with Complete Stack Traces

See ASP.NET stack trace details like filename and line number so you never have to guess. Filter and group ASP.NET exceptions intuitively to eliminate noise. Monitor errors at scale without impacting throughput in production.

### ASP.NET Performance Monitoring

Quickly identify ASP.NET performance issues before they become downtime with [Tracing](/product/tracing/). View the entire end-to-end distributed trace to see the exact, poor-performing API call and surface any related errors.

### Fill In The Blanks About ASP.NET Errors

Expose the important events that led to each ASP.NET exception: debug logs, network requests, database queries, past errors.

### See the Full Picture of Any ASP.NET Exception

With Sentry's exceptional exception handling in ASP.NET, you can triage quickly based on specific parameters like HTTP request, workflow stage, and hostname for each issue. Set custom tags to recreate the error environment relevant to your app, business concerns, and users.

---

*Source: [sentry.io/for/aspnet/](https://sentry.io/for/aspnet/)*
