AuthenticationManager.Register-Methode
Registriert ein Authentifizierungsmodul beim Authentifizierungsmanager.
Namespace: System.Net
Assembly: System (in system.dll)
Syntax
'Declaration
Public Shared Sub Register ( _
authenticationModule As IAuthenticationModule _
)
'Usage
Dim authenticationModule As IAuthenticationModule
AuthenticationManager.Register(authenticationModule)
public static void Register (
IAuthenticationModule authenticationModule
)
public:
static void Register (
IAuthenticationModule^ authenticationModule
)
public static void Register (
IAuthenticationModule authenticationModule
)
public static function Register (
authenticationModule : IAuthenticationModule
)
Parameter
- authenticationModule
Das IAuthenticationModule, das beim Authentifizierungsmanager registriert werden soll.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
authenticationModule ist NULL (Nothing in Visual Basic). |
Hinweise
Die Register-Methode fügt Authentifizierungsmodule am Ende der Liste der Module hinzu, die von der Authenticate-Methode aufgerufen werden. Authentifizierungsmodule werden in der Reihenfolge aufgerufen, in der sie der Liste hinzugefügt wurden. Wenn ein Modul mit demselben AuthenticationType bereits registriert ist, entfernt diese Methode das registrierte Modul und fügt am Ende der Liste authenticationModule hinzu.
Beispiel
Im folgenden Beispiel wird Authentifizierungsmodul im Authentifizierungsmanager registriert. Ein vollständiges Beispiel finden Sie unter der AuthenticationManager-Klasse.
' This is the program entry point. It allows the user to enter
' her credentials and the Internet resource (Web page) to access.
' It also unregisters the standard and registers the customized basic
' authentication.
Private Overloads Shared Sub Main(ByVal args() As String)
If args.Length < 4 Then
showusage()
Else
' Read the user's credentials.
uri = args(1)
username = args(2)
password = args(3)
If args.Length = 4 Then
domain = String.Empty
' If the domain exists, store it. Usually the domain name
' is by default the name of the server hosting the Internet
' resource.
Else
domain = args(5)
End If
' Unregister the standard Basic authentication module.
AuthenticationManager.Unregister("Basic")
' Instantiate the custom Basic authentication module.
Dim customBasicModule As New CustomBasic()
' Register the custom Basic authentication module.
AuthenticationManager.Register(customBasicModule)
' Display registered Authorization modules.
displayRegisteredModules()
' Read the specified page and display it on the console.
getPage(uri)
End If
Return
End Sub 'Main
// This is the program entry point. It allows the user to enter
// her credentials and the Internet resource (Web page) to access.
// It also unregisters the standard and registers the customized basic
// authentication.
public static void Main(string[] args)
{
if (args.Length < 3)
showusage();
else
{
// Read the user's credentials.
uri = args[0];
username = args[1];
password = args[2];
if (args.Length == 3)
domain = string.Empty;
else
// If the domain exists, store it. Usually the domain name
// is by default the name of the server hosting the Internet
// resource.
domain = args[3];
// Unregister the standard Basic authentication module.
AuthenticationManager.Unregister("Basic");
// Instantiate the custom Basic authentication module.
CustomBasic customBasicModule = new CustomBasic();
// Register the custom Basic authentication module.
AuthenticationManager.Register(customBasicModule);
// Display registered Authorization modules.
displayRegisteredModules();
// Read the specified page and display it on the console.
getPage(uri);
}
return;
}
// This is the program entry point. It allows the user to enter
// her credentials and the Internet resource (Web page) to access.
// It also unregisters the standard and registers the customized basic
// authentication.
static void Main()
{
array<String^>^args = Environment::GetCommandLineArgs();
if ( args->Length < 4 )
showusage();
else
{
// Read the user's credentials.
uri = args[ 1 ];
username = args[ 2 ];
password = args[ 3 ];
if ( args->Length == 4 )
domain = String::Empty; // If the domain exists, store it. Usually the domain name
else
domain = args[ 4 ];
// is by default the name of the server hosting the Internet
// resource.
// Unregister the standard Basic authentication module.
AuthenticationManager::Unregister( "Basic" );
// Instantiate the custom Basic authentication module.
CustomBasic^ customBasicModule = gcnew CustomBasic;
// Register the custom Basic authentication module.
AuthenticationManager::Register( customBasicModule );
// Display registered Authorization modules.
displayRegisteredModules();
// Read the specified page and display it on the console.
getPage( uri );
}
return;
}
// This is the program entry point. It allows the user to enter
// her credentials and the Internet resource (Web page) to access.
// It also unregisters the standard and registers the customized basic
// authentication.
public static void main(String[] args)
{
if (args.length < 3) {
Showusage();
}
else {
// Read the user's credentials.
uri = args[0];
username = args[1];
password = args[2];
if (args.length == 3) {
domain = "";
}
else {
// If the domain exists, store it. Usually the domain name
// is by default the name of the server hosting the Internet
// resource.
domain = args[3];
}
// Unregister the standard Basic authentication module.
AuthenticationManager.Unregister("Basic");
// Instantiate the custom Basic authentication module.
CustomBasic customBasicModule = new CustomBasic();
// Register the custom Basic authentication module.
AuthenticationManager.Register(customBasicModule);
// Display registered Authorization modules.
DisplayRegisteredModules();
// Read the specified page and display it on the console.
GetPage(uri);
}
return;
} //main
.NET Framework-Sicherheit
- SecurityPermission zum Ausführen von nicht verwaltetem Code. Zugeordnete Enumeration: SecurityPermissionFlag
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
AuthenticationManager-Klasse
AuthenticationManager-Member
System.Net-Namespace