Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Microsoft.AspNetCore.HttpOverrides.IPNetwork and KnownNetworks have been marked as obsolete in favor of using System.Net.IPNetwork and KnownIPNetworks.
Version introduced
.NET 10 Preview 7
Previous behavior
Previously, you could use Microsoft.AspNetCore.HttpOverrides.IPNetwork and KnownNetworks to configure known networks for the forwarded headers middleware:
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
KnownNetworks.Add(new(IPAddress.Loopback, 8))
});
New behavior
Starting in .NET 10, if you use the obsolete APIs in your code, you'll get warning ASPDEPR005 at compile time:
warning ASPDEPR005: Please use KnownIPNetworks instead. For more information, visit https://aka.ms/aspnet/deprecate/005.
Use the System.Net.IPNetwork type and KnownIPNetworks property instead.
Type of breaking change
This change can affect source compatibility.
Reason for change
System.Net.IPNetwork has replaced the Microsoft.AspNetCore.HttpOverrides.IPNetwork type that was implemented for ForwardedHeadersMiddleware.
Recommended action
Change to using System.Net.IPNetwork and KnownIPNetworks.