-
Notifications
You must be signed in to change notification settings - Fork 79
Open
Labels
Description
Description
Replacing IPNetwork
with System.Net.IPNetwork
.
Version
.NET 10 Preview 7
Previous behavior
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
KnownNetworks.Add(new(IPAddress.Loopback, 8))
});
New behavior
Using the APIs listed below will produce a compiler warning with diagnostic ID ASPDEPR005:
warning ASPDEPR005: Please use KnownIPNetworks instead. For more information, visit https://aka.ms/aspnet/deprecate/005.
Use the System.Net.IPNetwork
type and ForwardedHeadersOptions.KnownIPNetworks
property instead.
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
KnownIPNetworks.Add(new(IPAddress.Loopback, 8))
});
Type of breaking change
- Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
- Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
- Behavioral change: Existing binaries may behave differently at run time.
Reason for change
System.Net.IPNetwork
has replaced the IPNetwork
type that was implemented for ForwardedHeadersMiddleware
.
Recommended action
Change to using System.Net.IPNetwork
and KnownIPNetworks
.
Affected APIs
Microsoft.AspNetCore.HttpOverrides.IPNetwork
Microsoft.AspNetCore.Builder.ForwardedHeadersOptions.KnownNetworks