diff --git a/docs/core/compatibility/10.0.md b/docs/core/compatibility/10.0.md index 545e946cadccf..9e6cbb88d31ab 100644 --- a/docs/core/compatibility/10.0.md +++ b/docs/core/compatibility/10.0.md @@ -17,11 +17,12 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af ## ASP.NET Core -| Title | Type of change | Introduced version | -|-------|-------------------|--------------------| +| Title | Type of change | Introduced version | +|-------|---------------------|--------------------| | [Deprecation of WithOpenApi extension method](aspnet-core/10/withopenapi-deprecated.md) | Source incompatible | Preview 7 | | [IActionContextAccessor and ActionContextAccessor are obsolete](aspnet-core/10/iactioncontextaccessor-obsolete.md) | Source incompatible/behavioral change | Preview 7 | | [IncludeOpenAPIAnalyzers property and MVC API analyzers are deprecated](aspnet-core/10/openapi-analyzers-deprecated.md) | Source incompatible | Preview 7 | +| [IPNetwork and ForwardedHeadersOptions.KnownNetworks are obsolete](aspnet-core/10/ipnetwork-knownnetworks-obsolete.md) | Source incompatible | Preview 7 | | [Microsoft.Extensions.ApiDescription.Client package deprecated](aspnet-core/10/apidescription-client-deprecated.md) | Source incompatible | Preview 7 | ## Containers diff --git a/docs/core/compatibility/aspnet-core/10/ipnetwork-knownnetworks-obsolete.md b/docs/core/compatibility/aspnet-core/10/ipnetwork-knownnetworks-obsolete.md new file mode 100644 index 0000000000000..e322dc460ad1f --- /dev/null +++ b/docs/core/compatibility/aspnet-core/10/ipnetwork-knownnetworks-obsolete.md @@ -0,0 +1,50 @@ +--- +title: "Breaking change: IPNetwork and ForwardedHeadersOptions.KnownNetworks are obsolete" +description: Learn about the breaking change in ASP.NET Core 10.0 where IPNetwork and ForwardedHeadersOptions.KnownNetworks have been obsoleted in favor of System.Net.IPNetwork and KnownIPNetworks. +ms.date: 08/08/2025 +ai-usage: ai-assisted +ms.custom: https://github.com/aspnet/Announcements/issues/523 +--- +# IPNetwork and ForwardedHeadersOptions.KnownNetworks are obsolete + + and have been marked as obsolete in favor of using and `KnownIPNetworks`. + +## Version introduced + +.NET 10 Preview 7 + +## Previous behavior + +Previously, you could use and to configure known networks for the forwarded headers middleware: + +```csharp +app.UseForwardedHeaders(new ForwardedHeadersOptions +{ + KnownNetworks.Add(new(IPAddress.Loopback, 8)) +}); +``` + +## New behavior + +Starting in .NET 10, if you use [the obsolete APIs](#affected-apis) in your code, you'll get warning `ASPDEPR005` at compile time: + +> warning ASPDEPR005: Please use KnownIPNetworks instead. For more information, visit . + +Use the type and `KnownIPNetworks` property instead. + +## Type of breaking change + +This change can affect [source compatibility](../../categories.md#source-compatibility). + +## Reason for change + + has replaced the type that was implemented for . + +## Recommended action + +Change to using and `KnownIPNetworks`. + +## Affected APIs + +- +- diff --git a/docs/core/compatibility/toc.yml b/docs/core/compatibility/toc.yml index 5d759fa5537af..80e8cc44cf2dd 100644 --- a/docs/core/compatibility/toc.yml +++ b/docs/core/compatibility/toc.yml @@ -16,6 +16,8 @@ items: href: aspnet-core/10/iactioncontextaccessor-obsolete.md - name: IncludeOpenAPIAnalyzers property and MVC API analyzers are deprecated href: aspnet-core/10/openapi-analyzers-deprecated.md + - name: IPNetwork and ForwardedHeadersOptions.KnownNetworks are obsolete + href: aspnet-core/10/ipnetwork-knownnetworks-obsolete.md - name: Microsoft.Extensions.ApiDescription.Client package deprecated href: aspnet-core/10/apidescription-client-deprecated.md - name: Containers