Share via


FormsAuthenticationUserCollection.Remove(String) 方法

定义

从集合中移除 FormsAuthenticationUser 对象。

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

参数

name
String

要从集合中移除的 FormsAuthenticationUser 对象的名称。

例外

集合中不存在任何具有指定键的 FormsAuthenticationUser 对象,该元素已移除或该集合为只读。

示例

下面的代码示例说明如何使用 Remove 方法。

// Using method Remove.
// Execute the Remove method.
formsAuthenticationCredentials.Users.Remove("userName");

// Update if not locked
if (!authenticationSection.SectionInformation.IsLocked)
{
    configuration.Save();
}
' Using method Remove.
' Execute the Remove method.
formsAuthenticationCredentials.Users.Remove("userName")

' Update if not locked
If Not authenticationSection.SectionInformation.IsLocked Then
   configuration.Save()
End If

注解

此方法将 remove 元素插入配置文件的相应部分,以用于更高级别配置文件中定义的任何元素。 如果在当前配置文件的相应部分中定义了 元素,则会从配置文件中删除其条目。 要删除的对象必须存在于集合中。

适用于