WebHeaderCollection.AddWithoutValidate(String, String) 方法

定義

將標頭插入至集合,不檢查標頭是否在受限制標頭清單上。

protected:
 void AddWithoutValidate(System::String ^ headerName, System::String ^ headerValue);
protected void AddWithoutValidate (string headerName, string? headerValue);
protected void AddWithoutValidate (string headerName, string headerValue);
member this.AddWithoutValidate : string * string -> unit
Protected Sub AddWithoutValidate (headerName As String, headerValue As String)

參數

headerName
String

要加入至集合的標頭。

headerValue
String

標頭的內容。

例外狀況

headerNamenullEmpty 或含有無效字元。

-或-

headerValue 包含無效的字元。

僅限 .NET Framework 與 .NET Core:headerName 不是 null,且 headerValue 的長度太長 (大於 65,535 個字元)。

備註

方法會將 AddWithoutValidate 標頭新增至集合,而不需要檢查標頭是否位於受限制的標頭清單上。

注意

的長度headerValue只會在 .NET Framework 和 .NET Core 2.0 - 3.1 版中驗證。

給繼承者的注意事項

AddWithoutValidate(String, String)使用方法來新增通常透過屬性公開的標頭。

適用於