AuthenticationSection クラス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
Web アプリケーションの認証を構成します。 このクラスは継承できません。
public ref class AuthenticationSection sealed : System::Configuration::ConfigurationSection
public sealed class AuthenticationSection : System.Configuration.ConfigurationSection
type AuthenticationSection = class
inherit ConfigurationSection
Public NotInheritable Class AuthenticationSection
Inherits ConfigurationSection
- 継承
例
このセクションでは、2 つのコード例を示します。 1 つ目は、セクションのいくつかの属性に対して宣言的に値を指定する方法を authentication
示しています。これは、 クラスの AuthenticationSection メンバーとしてアクセスすることもできます。 2 つ目は、 クラスの使用方法を AuthenticationSection 示しています。
次の構成ファイルの例は、 セクションの値を宣言によって指定する方法を authentication
示しています。
注意
セクションを使用する credentials
場合は、「 ASP.NET 認証」で説明されているガイドラインに従ってください。 スケーラビリティとセキュリティを向上させるために、外部データベースを使用してユーザーの資格情報を格納することをお勧めします。
<authentication mode="Forms">
<forms name="MyAppCookieName" loginUrl="login.aspx">
<credentials passwordFormat="SHA1">
<user name="Kim"
password="07B7F3EE06F278DB966BE960E7CBBD103DF30CA6"/>
<user name="John"
password="BA56E5E0366D003E98EA1C7F04ABF8FCB3753889"/>
</credentials>
</forms>
</authentication>
この例では SHA1 を使用します。 SHA1 との競合問題のため、Microsoft では SHA256 を推奨しています。
次のコード例では、 クラスの使用方法 AuthenticationSection を示します。
// Get the Web application configuration.
System.Configuration.Configuration configuration =
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
// Get the section.
AuthenticationSection authenticationSection =
(AuthenticationSection)configuration.GetSection(
"system.web/authentication");
' Get the Web application configuration.
Dim configuration _
As System.Configuration.Configuration = _
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
' Get the section.
Dim authenticationSection _
As AuthenticationSection = _
CType(configuration.GetSection( _
"system.web/authentication"), AuthenticationSection)
注釈
AuthenticationSection クラスを使用すると、構成ファイルの authentication
セクションにプログラムからアクセスして変更できます。
注意
ではAuthenticationSection、 の値MachineToApplicationが である section プロパティAllowDefinitionで定義されている制限に従って、構成ファイルの関連セクションに情報を書き込むことができます。 階層内で許可されていないレベルで構成ファイルに書き込もうとすると、パーサーによってエラー メッセージが生成されます。 ただし、このクラスを使用すると、階層内の任意のレベルで構成情報を読み取ることができます。 安全性とスケーラビリティを確保するために、データベースなどの外部リポジトリを使用して、ユーザーの資格情報を保持することをお勧めします。
コンストラクター
AuthenticationSection() |
AuthenticationSection クラスの新しいインスタンスを初期化します。 |
プロパティ
メソッド
適用対象
こちらもご覧ください
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示