authentication 要素 (ASP.NET 設定スキーマ)

[このドキュメントはプレビューのみを目的としており、以降のリリースで変更される可能性があります。プレースホルダーとして空白のトピックが含まれています。]

ASP.NET アプリケーションを参照するユーザーの識別に使用する、ASP.NET 認証スキーマを構成します。

<authentication 
   mode="[Windows|Forms|Passport|None]"
> 
   <forms>...</forms>
   <passport/>
</authentication>

属性および要素

以降のセクションでは、属性、子要素、および親要素について説明します。

属性

属性

Description

mode

必須の属性です。

アプリケーションの既定の認証モードを指定します。 この属性には、次のいずれかの値を指定できます。

値Description
Windows 既定の認証モードとして Windows 認証を指定します。このモードは、なんらかの形式の Microsoft Internet Information Services (IIS) 認証 (基本認証、ダイジェスト認証、統合 Windows 認証 (NTLM/Kerberos)、または証明書) を使用する場合に使用します。この場合、アプリケーションは認証の責任を、基になる IIS に委任します。
Forms 既定の認証モードとして ASP.NET フォーム ベース認証を指定します。
Passport 既定の認証モードとして Microsoft パスポート ネットワーク認証を指定します。
None 認証を指定しません。アプリケーションで匿名ユーザーだけを想定しているか、またはアプリーションが独自の認証を提供しています。

既定値は、Windows です。

子要素

要素

Description

forms

ASP.NET アプリケーションをカスタム フォーム ベース認証に合わせて設定します。

passport

認証が必要なページに Microsoft パスポート ネットワーク認証を使用せずにサインインしたユーザーをリダイレクトする先のページを指定します。

親要素

要素

Description

configuration

共通言語ランタイムおよび .NET Framework アプリケーションで使用されるすべての構成ファイルで必要なルート要素を指定します。

system.web

構成ファイルの ASP.NET 構成設定のルート要素を指定します。ASP.NET Web アプリケーションを構成する構成要素やアプリケーションの動作を制御する構成要素が含まれます。

解説

authentication 要素は、ASP.NET アプリケーションの ASP.NET 認証スキーマを構成します。 この認証スキーマは、ASP.NET アプリケーションを参照するユーザーの識別方法を決定します。 mode 属性は、認証スキーマを指定します。 使用できる認証スキーマの詳細については、「ASP.NET Authentication」を参照してください。

既定の構成

次の既定の authentication 要素は、Machine.config ファイルまたはルート Web.config ファイルで明示的には構成されていません。 ただし、これは .NET Framework Version 2.0 のアプリケーションにより返される既定の構成です。

<authentication mode="Windows">
   <forms 
      name=".ASPXAUTH" 
      loginUrl="login.aspx" 
      defaultUrl="default.aspx" 
      protection="All" 
      timeout="30" 
      path="/" 
      requireSSL="false" 
      slidingExpiration="true" 
      cookieless="UseDeviceProfile" domain="" 
      enableCrossAppRedirects="false">
      <credentials passwordFormat="SHA1" />
   </forms>
   <passport redirectUrl="internal" />
</authentication>

次の既定の authentication 要素は、.NET Framework Version 1.1 の Machine.config ファイルで構成されます。

<authentication mode="Windows">
   <forms 
      name=".ASPXAUTH" 
      loginUrl="login.aspx" 
      protection="All"  
      timeout="30" 
      path="/" 
      requireSSL="false" 
      slidingExpiration="true">
      <credentials passwordFormat="SHA1"></credentials>
   </forms>
   <passport redirectUrl="internal" />
</authentication>

次の既定の authentication 要素は、.NET Framework Version 1.0 の Machine.config ファイルで構成されます。

<authentication mode="Windows">
   <forms 
      name=".ASPXAUTH" 
      loginUrl="login.aspx" 
      protection="All"  
      timeout="30" 
      path="/" >
      <credentials passwordFormat="SHA1"></credentials>
   </forms>
   <passport redirectUrl="internal" />
</authentication>

使用例

フォーム ベース認証のサイトを設定し、クライアントからのログオン情報を伝送するクッキーの名前を指定し、最初の認証が失敗したときに使用するログオン ページの名前を指定する方法を、次のコード例に示します。 すべてのユーザーによるフォーム認証を要求し、匿名ユーザーのサイトへのアクセスを拒否するには、authorization セクションを含める必要があります。

<configuration>
   <system.web>
      <authentication mode="Forms">
         <forms name="401kApp" loginUrl="/login.aspx"/>
      </authentication>
      <authorization>
         <deny users="?"/>
      </authorization>
   </system.web>
</configuration>

要素情報

構成セクション ハンドラー

AuthenticationSection

構成メンバー

AuthenticationMode

構成できる場所

Machine.config

ルート レベルの Web.config

アプリケーション レベルの Web.config

要件

Microsoft Internet Information Services (IIS) バージョン 5.0、5.1、または 6.0

.NET Framework Version 1.0、1.1、または 2.0

Microsoft Visual Studio 2003 または Visual Studio 2005

参照

処理手順

How to: Configure Specific Folders Using Location Settings

How to: Lock ASP.NET Configuration Settings

Reference

system.web 要素 (ASP.NET 設定スキーマ)

authentication の forms 要素 (ASP.NET 設定スキーマ)

authentication の passport 要素 (ASP.NET 設定スキーマ)

configuration 要素 (全般設定スキーマ)

System.Configuration

System.Web.Configuration

AuthenticationSection

概念

ASP.NET Configuration File Hierarchy

Securing Configuration

Configuration Inheritance

その他の技術情報

ASP.NET Authentication

全般構成設定 (ASP.NET)

ASP.NET 構成設定

Configuring ASP.NET Applications

ASP.NET Configuration Files

ASP.NET Configuration API