Export (0) Print
Expand All

AuthenticationManager.Unregister Method (String)

.NET Framework 1.1

Removes authentication modules with the specified authentication scheme from the list of registered modules.

[Visual Basic]
Overloads Public Shared Sub Unregister( _
   ByVal authenticationScheme As String _
)
[C#]
public static void Unregister(
 string authenticationScheme
);
[C++]
public: static void Unregister(
 String* authenticationScheme
);
[JScript]
public static function Unregister(
   authenticationScheme : String
);

Parameters

authenticationScheme
The authentication scheme of the module to remove.

Exceptions

Exception Type Condition
ArgumentNullException authenticationScheme is a null reference (Nothing in Visual Basic).
InvalidOperationException A module for this authentication scheme is not registered.

Remarks

The Unregister method removes the authentication module with the specified authentication scheme from the list of authentication modules called by the Authenticate method. The module must have been added to the list using the Register method before it can be removed from the list.

Example

[Visual Basic, C#, C++] The following example uses the Unregister method to remove an authentication module with the specified authentication scheme from the list of registered modules.

[Visual Basic] 
Dim registeredModules As IEnumerator = AuthenticationManager.RegisteredModules
DisplayAllModules()

registeredModules.Reset()
registeredModules.MoveNext()

'Get the first Authentication module registered with the system
Dim authenticationModule1 As IAuthenticationModule = CType(registeredModules.Current, IAuthenticationModule)

'Call the UnRegister method to unregister the first authentication module from the system.
Dim authenticationScheme As [String] = authenticationModule1.AuthenticationType
AuthenticationManager.Unregister(authenticationScheme)
Console.WriteLine(ControlChars.Cr + "Successfully unregistered {0}", authenticationModule1)
'Display all modules to see that the module was unregistered.
DisplayAllModules()
'Call the Register method to register authenticationModule1 module again.
AuthenticationManager.Register(authenticationModule1)
Console.WriteLine(ControlChars.Cr + "Successfully re-registered {0}", authenticationModule1)
'Display the modules to verify that 'authenticationModule1' has been registered again.
DisplayAllModules()

[C#] 
IEnumerator registeredModules = AuthenticationManager.RegisteredModules; 
// Display all the modules that are already registered with the system.
DisplayAllModules();  
registeredModules.Reset();
registeredModules.MoveNext();
// Get the first Authentication module registered with the system.
IAuthenticationModule authenticationModule1 = (IAuthenticationModule)registeredModules.Current; 
// Call the UnRegister() method to unregister the first authentication module from the system.
String authenticationScheme = authenticationModule1.AuthenticationType;
AuthenticationManager.Unregister(authenticationScheme);
Console.WriteLine("\nSuccessfully unregistered '{0}",authenticationModule1+"'."); 
// Display all modules to see that the module was unregistered.
DisplayAllModules(); 

[C++] 
IEnumerator * registeredModules = AuthenticationManager::RegisteredModules; 
// Display all the modules that are already registered with the system.
DisplayAllModules();  
registeredModules->Reset();
registeredModules->MoveNext();
// Get the first Authentication module registered with the system.
IAuthenticationModule * authenticationModule1 = 
   dynamic_cast<IAuthenticationModule*>(registeredModules->Current);
// Call the UnRegister() method to unregister the first authentication module from the system.
String * authenticationScheme = authenticationModule1->AuthenticationType;
AuthenticationManager::Unregister(authenticationScheme);
Console::WriteLine("\nSuccessfully unregistered '{0}'.",authenticationModule1);
// Display all modules to see that the module was unregistered.
DisplayAllModules(); 

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

.NET Framework Security: 

See Also

AuthenticationManager Class | AuthenticationManager Members | System.Net Namespace | AuthenticationManager.Unregister Overload List

Show:
© 2014 Microsoft