.NET SDK
Install the ErrTap NuGet package for ASP.NET Core — middleware for unhandled exceptions plus manual capture and structured logs. Includes a snippet for classic ASP.NET Framework.
Install
dotnet add package ErrTapUntil the package is published to NuGet, reference the project from the monorepo:
<ProjectReference Include="path/to/sdk/sdk-dotnet/ErrTap.csproj" />ASP.NET Core setup
// Program.cs
using ErrTap;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddErrTap(o =>
{
o.Dsn = builder.Configuration["ErrTap:Dsn"]!; // https://et_…@api.errtap.com
o.Environment = builder.Environment.EnvironmentName;
});
var app = builder.Build();
app.UseErrTap(); // report unhandled exceptions, then rethrow
app.Run();// appsettings.json
{
"ErrTap": {
"Dsn": "https://et_your_key@api.errtap.com"
}
}UseErrTap() adds middleware that reports any unhandled exception and rethrows it, so your
existing error pages and logging keep working.
Manual capture & logs
The static ErrTap class is available anywhere after setup:
try { /* … */ }
catch (Exception ex)
{
ErrTap.CaptureException(ex);
throw;
}
ErrTap.Info("checkout started", new Dictionary<string, object?> { ["orderId"] = id });
// also: ErrTap.Debug / ErrTap.Warning / ErrTap.Error / ErrTap.CaptureMessageOptions
| Field | Type | Description |
|---|---|---|
Dsn | string | URL DSN (https://et_…@host) or bare key (requires Endpoint) |
Endpoint | string? | Override for /ingest/error; required when Dsn is a bare key |
Environment | string | Defaults to production |
Release | string? | Ties errors to a deploy |
Tags | IDictionary<string, object?>? | Attached to every event |
Classic ASP.NET (Framework)
There's no NuGet package for System.Web — post directly to the ingest API from
Application_Error:
// Global.asax.cs — Application_Error (.NET Framework / System.Web)
using System;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;
protected void Application_Error(object sender, EventArgs e)
{
var ex = Server.GetLastError()?.GetBaseException();
if (ex == null) return;
var json = new JavaScriptSerializer().Serialize(new
{
message = ex.Message,
type = ex.GetType().FullName,
stacktrace = ex.ToString(),
environment = "production",
});
using (var client = new HttpClient())
using (var req = new HttpRequestMessage(HttpMethod.Post, "https://your-host/ingest/error"))
{
req.Headers.TryAddWithoutValidation("Authorization", "DSN et_<your-key>");
req.Content = new StringContent(json, Encoding.UTF8, "application/json");
client.SendAsync(req); // fire-and-forget; never block the error page
}
}See the Ingest API reference for the full payload shape.