語言

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方法會回傳包含驗證訊息的PreAuthenticateAuthorization類別實例。

適用於