语言

IAuthenticationModule.PreAuthenticate(WebRequest, ICredentials) 方法

定义

返回向服务器发送身份验证请求的 Authorization 类实例。

public:
 System::Net::Authorization ^ PreAuthenticate(System::Net::WebRequest ^ request, System::Net::ICredentials ^ credentials);
public System.Net.Authorization? PreAuthenticate(System.Net.WebRequest request, System.Net.ICredentials credentials);
public System.Net.Authorization PreAuthenticate(System.Net.WebRequest request, System.Net.ICredentials credentials);
abstract member PreAuthenticate : System.Net.WebRequest * System.Net.ICredentials -> System.Net.Authorization
Public Function PreAuthenticate (request As WebRequest, credentials As ICredentials) As Authorization

参数

request
WebRequest

与 WebRequest 身份验证请求关联的实例。

credentials
ICredentials

与身份验证请求关联的凭据。

返回

包含 Authorization 请求的授权消息的实例。

示例

以下示例演示如何使用 PreAuthenticate 该方法。 有关完整示例,请参阅该 AuthenticationManager 类。

// 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;
}
' 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 Function PreAuthenticate(ByVal request As WebRequest, ByVal credentials As ICredentials) As Authorization _
    Implements IAuthenticationModule.PreAuthenticate

  Return Nothing
End Function 'PreAuthenticate

注解

CanPreAuthenticate当属性为true时,该方法PreAuthenticate将返回包含身份验证消息的Authorization类的实例。

适用于