IHeaderDictionary.Add throws on a repeated header (ASP0019)
Esta página aún no está disponible en tu idioma.
Key dotnet.api.header-dictionary-add · Severity warning · Category api
ASP.NET Core analyzer ASP0019. Flags IHeaderDictionary.Add, which throws when the header is already present; Append or the indexer set it safely.
Incorrect
Section titled “Incorrect”context.Response.Headers.Add("Cache-Control", "no-store");Correct
Section titled “Correct”context.Response.Headers.CacheControl = "no-store";// or: context.Response.Headers.Append("X-Trace", id);