Export (0) Print
Expand All

AuthenticationManager.Unregister Method

Removes authentication modules from the list of registered modules.

Overload List

Removes the specified authentication module from the list of registered modules.

Supported by the .NET Compact Framework.

[Visual Basic] Overloads Public Shared Sub Unregister(IAuthenticationModule)
[C#] public static void Unregister(IAuthenticationModule);
[C++] public: static void Unregister(IAuthenticationModule*);
[JScript] public static function Unregister(IAuthenticationModule);

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

Supported by the .NET Compact Framework.

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

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, C#, C++] Note   This example shows how to use one of the overloaded versions of Unregister. For other examples that might be available, see the individual overload topics.
[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.

See Also

AuthenticationManager Class | AuthenticationManager Members | System.Net Namespace

Show:
© 2014 Microsoft