Back to Aspnetcore

ASP0019: Suggest using IHeaderDictionary.Append or the indexer

aspnetcore/diagnostics/asp0019.md

latest852 B
Original Source

ASP0019: Suggest using IHeaderDictionary.Append or the indexer

Value
Rule IDASP0019
CategoryUsage
Fix is breaking or non-breakingNon-breaking

Cause

IDictionary.Add isn't recommended for setting or appending headers. IDictionary.Add throws an ArgumentException when attempting to add a duplicate key.

Rule description

IDictionary.Add isn't recommended for setting or appending headers.

How to fix violations

To fix a violation of this rule, use IHeaderDictionary.Append or the indexer to append or set headers.

When to suppress warnings

Do not suppress a warning from this rule.