Skip to content

Commit 5067eec

Browse files
committed
updated .net versions
1 parent 9ad5883 commit 5067eec

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

articles/azure-monitor/app/ip-collection.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,32 @@ namespace MyWebApp
160160
> [!NOTE]
161161
> If you can't access `ISupportProperties`, make sure you're running the latest stable release of the Application Insights SDK. `ISupportProperties` is intended for high cardinality values. `GlobalProperties` is more appropriate for low cardinality values like region name and environment name.
162162
163-
### Enable the telemetry initializer for ASP.NET
163+
164+
# [.NET 6.0+](tab/framework)
164165

165166
```csharp
166-
using Microsoft.ApplicationInsights.Extensibility;
167+
using Microsoft.ApplicationInsights.Extensibility;
168+
using CustomInitializer.Telemetry;
169+
170+
builder.services.AddSingleton<ITelemetryInitializer, CloneIPAddress>();
171+
```
172+
173+
# [.NET 5.0](tab/framework)
174+
175+
```csharp
176+
using Microsoft.ApplicationInsights.Extensibility;
177+
using CustomInitializer.Telemetry;
167178

179+
public void ConfigureServices(IServiceCollection services)
180+
{
181+
services.AddSingleton<ITelemetryInitializer, CloneIPAddress>();
182+
}
183+
```
184+
185+
# [ASP.NET Framework](tab/framework)
186+
187+
```csharp
188+
using Microsoft.ApplicationInsights.Extensibility;
168189

169190
namespace MyWebApp
170191
{
@@ -180,18 +201,7 @@ namespace MyWebApp
180201

181202
```
182203

183-
### Enable the telemetry initializer for ASP.NET Core
184-
185-
You can create your telemetry initializer the same way for ASP.NET Core as for ASP.NET. To enable the initializer, use the following example for reference:
186-
187-
```csharp
188-
using Microsoft.ApplicationInsights.Extensibility;
189-
using CustomInitializer.Telemetry;
190-
public void ConfigureServices(IServiceCollection services)
191-
{
192-
services.AddSingleton<ITelemetryInitializer, CloneIPAddress>();
193-
}
194-
```
204+
---
195205

196206
# [Node.js](#tab/nodejs)
197207

0 commit comments

Comments
 (0)