Removes all System.Web.Configuration.CustomError objects from the collection.
The result of updating the configuration file after calling the CustomErrorCollection.Clear method is dependent upon the System.Configuration.ConfigurationSaveMode chosen. To update the configuration file, you use one of these two overloads: System.Configuration.Configuration.Save and System.Configuration.Configuration.Save(System.Configuration.ConfigurationSaveMode).
Calling System.Configuration.Configuration.Save is equivalent to calling System.Configuration.Configuration.Save(System.Configuration.ConfigurationSaveMode).
If you use the System.Configuration.Configuration.Save(System.Configuration.ConfigurationSaveMode).method, the following conditions apply.
If you pass a System.Configuration.ConfigurationSaveMode.Full or System.Configuration.ConfigurationSaveMode.Modified parameter value, then a clear element is inserted into the clientTarget section of the configuration file at the current hierarchy level.
If you pass the System.Configuration.ConfigurationSaveMode.Minimal parameter value, a series of remove elements are added to the clientTarget Element (ASP.NET Settings Schema) of the configuration file at the current hierarchy level. Each removes all references to an add element defined in a parent configuration file at a higher level in the hierarchy. When you use System.Configuration.ConfigurationSaveMode.Minimal, there is one additional property on the collection that affects what gets serialized to the configuration file: System.Configuration.ConfigurationElementCollection.EmitClear, which is false by default. The following conditions apply.
The CustomErrorCollection.Clear method actually deletes the add elements defined in the clientTarget section of the configuration file at the current hierarchy level. It also removes all references to the add elements defined in the parent configuration files at higher levels in the hierarchy.
The add elements are not deleted from the clientTarget section of the parent configuration files.