--- title: "ASP0019: Suggest using IHeaderDictionary.Append or the indexer" description: "Learn about analysis rule ASP0019: Suggest using IHeaderDictionary.Append or the indexer" author: tdykstra monikerRange: '>= aspnetcore-8.0' ms.author: tdykstra ms.date: 11/22/2022 uid: diagnostics/asp0019 --- # ASP0019: Suggest using IHeaderDictionary.Append or the indexer | | Value | |-|-| | **Rule ID** |ASP0019| | **Category** |Usage| | **Fix is breaking or non-breaking** |Non-breaking| ## Cause `IDictionary.Add` isn't recommended for setting or appending headers. [`IDictionary.Add`](xref:System.Collections.IDictionary.Add%2A) 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.