CustomErrorCollection.Remove(String) メソッド

定義

CustomError オブジェクトをコレクションから削除します。

public:
 void Remove(System::String ^ statusCode);
public void Remove(string statusCode);
member this.Remove : string -> unit
Public Sub Remove (statusCode As String)

パラメーター

statusCode
String

カスタム エラーに関連付けられている HTTP 状態コード。

次のコード例は、指定した状態コードを使用して CustomError オブジェクトを削除する方法を示しています。 コレクションを取得する方法については、 CustomErrorCollection クラスのトピックのコード例を参照してください。

// Using the Remove method.
if (!customErrorsSection.SectionInformation.IsLocked)
{
    // Remove the error with statuscode 404.
    customErrorsCollection.Remove("404");
    configuration.Save();
}
' Using the Remove method.
If Not customErrorsSection.SectionInformation.IsLocked Then
   ' Remove the error with statuscode 404.
   customErrorsCollection.Remove("404")
   configuration.Save()
End If

注釈

Remove メソッドは、現在の階層レベルの構成ファイルのremove セクションにcustomErrors要素を挿入します。 これにより、階層内の上位レベルの親構成ファイルで定義されている add 要素への参照が削除されます。

Note

add要素は、親構成ファイルから削除されません。 remove要素は、単に非アクティブ化するだけです。 ただし、 Remove メソッドでは、現在の階層レベルで実際に削除されます。

適用対象