CustomErrorCollection.Set(CustomError) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定された CustomError をコレクションに追加します。
public:
void Set(System::Web::Configuration::CustomError ^ customError);
public void Set (System.Web.Configuration.CustomError customError);
member this.Set : System.Web.Configuration.CustomError -> unit
Public Sub Set (customError As CustomError)
パラメーター
- customError
- CustomError
コレクションに追加する CustomError。
例
次のコード例は、指定した CustomError オブジェクトを設定する方法を示しています。 コレクションを取得する方法については、クラス トピックの CustomErrorCollection コード例を参照してください。
// Using the Set method.
CustomError newCustomError =
new CustomError(404, "customerror404.htm");
// Update the configuration file.
if (!customErrorsSection.SectionInformation.IsLocked)
{
// Add the new custom error to the collection.
customErrorsCollection.Set(newCustomError);
configuration.Save();
}
' Using the Set method.
Dim newCustomError _
As New CustomError(404, "customerror404.htm")
' Update the configuration file.
If Not customErrorsSection.SectionInformation.IsLocked Then
' Add the new custom error to the collection.
customErrorsCollection.Set(newCustomError)
configuration.Save()
End If
注釈
この指定されたエラーは、現在の構成エラー要素を置き換えます。