Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/platforms/dotnet/guides/aspnet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
<configuration>
<appSettings>
<add key="SentryDsn" value="___PUBLIC_DSN___" />
</appSettings>
</configuration>
```

Comment on lines +36 to +45
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: add short web.config example, without replacing the existing quick-start guide

I do like the example!
But I would prefer if we list the web.config example as an additional alternative to the "default" hardcoded variant.

E.g. before the section ### Capturing the affected user

  • add a new sub-section
    • e.g. ### Configure via `web.config` file
  • insert this text and code snipped in the new sub-section
  • insert a short C# snippet consuming the web.config:
SentrySdk.Init(options =>
{
  options.Dsn = ConfigurationManager.AppSettings["SentryDsn"];
});


```csharp
using System;
using System.Configuration;
using System.Web;
using Sentry.AspNet;
using Sentry.EntityFramework; // If you also installed Sentry.EntityFramework
Expand All @@ -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"];

This comment was marked as outdated.

// 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.
Expand Down
Loading