FormsAuthenticationConfiguration クラス
アセンブリ: System.Web (system.web.dll 内)
構文
解説FormsAuthenticationConfiguration クラスを使用すると、authentication 構成セクションの forms 要素にプログラムからアクセスして変更できます。
この型は、FormsAuthenticationCredentials 型、FormsAuthenticationUserCollection 型、FormsAuthenticationUser 型を含むグループの一部です。コレクション型以外の型は、基になる構成タグに直接影響を与えます。
メモ |
|---|
| FormsAuthenticationConfiguration は、値が MachineToApplication のセクション プロパティ AllowDefinition で定義される制限に従って構成ファイルの関連するセクションに情報を書き込むことができます。階層構造の許可されていないレベルで構成ファイルに書き込みを行おうとした場合、パーサーによってエラー メッセージが生成されます。ただし、このクラスを使用して、階層構造の任意のレベルに構成情報を読み込むことができます。安全性とスケーラビリティを高めるため、データベースなど、外部のリポジトリを使用して、ユーザーの資格情報を維持することをお勧めします。 |
使用例既存の Web アプリケーションの構成ファイルから FormsAuthenticationConfiguration オブジェクトを取得する方法を次のコード例に示します。このオブジェクトを使用して、メンバにアクセスできます。構成ファイルには、次のようなセットアップが格納されます。
メモ credentials セクションを使用する場合は、「ASP.NET の認証」に説明されているガイドラインに従う必要があります。スケーラビリティとセキュリティを高めるため、外部のデータベースを使用して、ユーザーの資格情報を保管することをお勧めします。安全な ASP.NET アプリケーションを構築する方法の詳細については、Microsoft MSDN Web サイト (msdn.microsoft.com) で、「Securing Your ASP.NET Application」や「Building Secure ASP.NET Applications: Authentication, Authorization, and Secure Communication」を参照してください。
<authentication mode="Forms"> <forms name="MyAppCookie" loginUrl="login.aspx" defaultUrl="default.aspx" protection="Encryption" timeout="5" path="aspnetTest" slidingExpiration="false" cookieless="UseCookies" domain="domainName"> <credentials passwordFormat="SHA1"> <user name="aspnetuser1" password="5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8"/> <user name="aspnetuser2" password="E38AD214943DAAD1D64C102FAEC29DE4AFE9DA3D"/> </credentials> </forms> </authentication>
' Get the Web application configuration. Dim configuration As System.Configuration.Configuration = _ WebConfigurationManager.OpenWebConfiguration( _ "/aspnetTest") ' Get the external Authentication section. Dim authenticationSection _ As AuthenticationSection = _ CType(configuration.GetSection( _ "system.web/authentication"), AuthenticationSection) ' Get the external Forms section . Dim formsAuthentication _ As FormsAuthenticationConfiguration = _ authenticationSection.Forms
// Get the Web application configuration. System.Configuration.Configuration configuration = WebConfigurationManager.OpenWebConfiguration("/aspnetTest"); // Get the external Authentication section. AuthenticationSection authenticationSection = (AuthenticationSection)configuration.GetSection( "system.web/authentication"); // Get the external Forms section . FormsAuthenticationConfiguration formsAuthentication = authenticationSection.Forms;
継承階層System.Configuration.ConfigurationElement
System.Web.Configuration.FormsAuthenticationConfiguration
スレッド セーフ
プラットフォームWindows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
参照Weblioに収録されているすべての辞書からFormsAuthenticationConfiguration クラスを検索する場合は、下記のリンクをクリックしてください。
全ての辞書からFormsAuthenticationConfiguration クラス
を検索
- FormsAuthenticationConfiguration クラスのページへのリンク
.gif)