AuthenticationManager.PreAuthenticate(WebRequest, ICredentials) Metoda

Definicja

Przestroga

The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.

Wstępnie uwierzytelnia żądanie.

public:
 static System::Net::Authorization ^ PreAuthenticate(System::Net::WebRequest ^ request, System::Net::ICredentials ^ credentials);
[System.Obsolete("The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0009", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Net.Authorization? PreAuthenticate (System.Net.WebRequest request, System.Net.ICredentials credentials);
public static System.Net.Authorization? PreAuthenticate (System.Net.WebRequest request, System.Net.ICredentials credentials);
public static System.Net.Authorization PreAuthenticate (System.Net.WebRequest request, System.Net.ICredentials credentials);
[<System.Obsolete("The AuthenticationManager Authenticate and PreAuthenticate methods are not supported and throw PlatformNotSupportedException.", DiagnosticId="SYSLIB0009", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member PreAuthenticate : System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
static member PreAuthenticate : System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
Public Shared Function PreAuthenticate (request As WebRequest, credentials As ICredentials) As Authorization

Parametry

request
WebRequest

Żądanie do zasobu internetowego.

credentials
ICredentials

Poświadczenia skojarzone z żądaniem.

Zwraca

Wystąpienie Authorization klasy, jeśli żądanie może być wstępnie uwierzytelnione; w przeciwnym razie . null Jeśli credentials parametr ma nullwartość , ta metoda zwraca wartość null.

Atrybuty

Wyjątki

Tylko platformy .NET Core i .NET 5+: we wszystkich przypadkach.

request to null.

Uwagi

Jeśli moduł uwierzytelniania może wstępnie uwierzytelnić żądanie, PreAuthenticate metoda zwraca wystąpienie uwierzytelniania i wysyła informacje o autoryzacji do serwera z preemptively zamiast czekać na zasób, aby wystawić wyzwanie. To zachowanie opisano w sekcji 3.3 RFC 2617 (Uwierzytelnianie HTTP: uwierzytelnianie podstawowe i szyfrowane). Moduły uwierzytelniania, które obsługują wstępne uwierzytelnianie, umożliwiają klientom zwiększenie wydajności serwera dzięki unikaniu dodatkowych rund spowodowanych przez wyzwania związane z uwierzytelnianiem.

Moduły autoryzacji, które mogą wstępnie uwierzytelniać żądania, ustawiają IAuthenticationModule.CanPreAuthenticate właściwość na truewartość .

Dotyczy