From 7526cc58d6a065615e60ea2a929ae687ea9d8026 Mon Sep 17 00:00:00 2001 From: fuguikz <2514883828@qq.com> Date: Fri, 19 Dec 2025 19:28:44 +0800 Subject: [PATCH] docs(dotnet): add Web.config DSN example for ASP.NET --- docs/platforms/dotnet/guides/aspnet/index.mdx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/platforms/dotnet/guides/aspnet/index.mdx b/docs/platforms/dotnet/guides/aspnet/index.mdx index 9dc391e97ef7b7..be94058edf97e1 100644 --- a/docs/platforms/dotnet/guides/aspnet/index.mdx +++ b/docs/platforms/dotnet/guides/aspnet/index.mdx @@ -33,9 +33,20 @@ as well as your logs as breadcrumbs. The logging integrations also capture event You configure the SDK in the `Global.asax.cs`: +If you'd prefer not to hardcode your DSN in your source code, you can store it in your `Web.config` file: + +```xml {filename:Web.config} + + + + + +``` + ```csharp using System; +using System.Configuration; using System.Web; using Sentry.AspNet; using Sentry.EntityFramework; // If you also installed Sentry.EntityFramework @@ -50,7 +61,7 @@ public class MvcApplication : HttpApplication // Initialize Sentry to capture AppDomain unhandled exceptions and more. _sentry = SentrySdk.Init(options => { - options.Dsn = "___PUBLIC_DSN___"; + options.Dsn = ConfigurationManager.AppSettings["SentryDsn"]; // When configuring for the first time, to see what the SDK is doing: options.Debug = true; // Adds request URL and headers, IP and name for users, etc.