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
22 changes: 20 additions & 2 deletions docs/platforms/dotnet/guides/aspnet/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ as well as your logs as breadcrumbs. The logging integrations also capture event
## Configure

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


```csharp
using System;
using System.Web;
Expand Down Expand Up @@ -91,6 +89,26 @@ public class MvcApplication : HttpApplication
}
```

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>
```

And then read it from `ConfigurationManager.AppSettings`:

```csharp
using System.Configuration;

// ...

options.Dsn = ConfigurationManager.AppSettings["SentryDsn"];
```

### Capturing the affected user

When opting-in to [SendDefaultPii](#senddefaultpii), the SDK will automatically read the user from the request by inspecting `HttpContext.User`. Default claim values like `NameIdentifier` for the _Id_ will be used.
Expand Down