IAuthenticationModule.PreAuthenticate(WebRequest, ICredentials) Method

Definition

Returns an instance of the Authorization class for an authentication request to a server.

C#
public System.Net.Authorization? PreAuthenticate(System.Net.WebRequest request, System.Net.ICredentials credentials);
C#
public System.Net.Authorization PreAuthenticate(System.Net.WebRequest request, System.Net.ICredentials credentials);

Parameters

request
WebRequest

The WebRequest instance associated with the authentication request.

credentials
ICredentials

The credentials associated with the authentication request.

Returns

An Authorization instance containing the authorization message for the request.

Examples

The following example shows how to use the PreAuthenticate method. For a complete example refer to the AuthenticationManager class.

C#
// The PreAuthenticate method specifies whether the authentication implemented
// by this class allows pre-authentication.
// Even if you do not use it, this method must be implemented to obey to the rules
// of interface implementation.
// In this case it always returns null.
public Authorization PreAuthenticate(WebRequest request, ICredentials credentials)
{
  return null;
}

Remarks

When the CanPreAuthenticate property is true, the PreAuthenticate method will return an instance of the Authorization class containing an authentication message.

Applies to

Produkt Versioner
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1