次の方法で共有


AuthenticationManager.PreAuthenticate メソッド

要求の事前認証を行います。

Public Shared Function PreAuthenticate( _
   ByVal request As WebRequest, _   ByVal credentials As ICredentials _) As Authorization
[C#]
public static Authorization PreAuthenticate(WebRequestrequest,ICredentialscredentials);
[C++]
public: static Authorization* PreAuthenticate(WebRequest* request,ICredentials* credentials);
[JScript]
public static function PreAuthenticate(
   request : WebRequest,credentials : ICredentials) : Authorization;

パラメータ

  • request
    インターネット リソースへの WebRequest
  • credentials
    要求と関連付けられた ICredentials

戻り値

要求を事前認証できる場合は Authorization クラスのインスタンス。それ以外の場合は null 参照 (Visual Basic では Nothing) 。 credentials が null 参照 (Nothing) の場合、このメソッドは null 参照 (Nothing) を返します。

例外

例外の種類 条件
ArgumentNullException requestnull.

解説

認証モジュールが要求を事前認証できる場合、PreAuthenticate メソッドは Authentication インスタンスを返し、リソースがチャレンジを発行するまで待機せずに、サーバーに対してプリエンプティブに認証情報を送信します。この動作については、RFC 2617 (HTTP Authentication: Basic and Digest Access Authentication) のセクション 3.3 に概要が示されています。事前認証をサポートする認証モジュールによって、クライアントは認証チャレンジから生じる余分なラウンドトリップを回避して、サーバーの効率を向上させることができます。

要求を事前認証できる認証モジュールは、 IAuthenticationModule.CanPreAuthenticate プロパティを true に設定します。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET, Common Language Infrastructure (CLI) Standard

参照

AuthenticationManager クラス | AuthenticationManager メンバ | System.Net 名前空間