FormsAuthenticationConfiguration.Credentials プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ユーザー名とパスワードの FormsAuthenticationCredentials コレクションを取得します。
public:
property System::Web::Configuration::FormsAuthenticationCredentials ^ Credentials { System::Web::Configuration::FormsAuthenticationCredentials ^ get(); };
[System.Configuration.ConfigurationProperty("credentials")]
public System.Web.Configuration.FormsAuthenticationCredentials Credentials { get; }
[<System.Configuration.ConfigurationProperty("credentials")>]
member this.Credentials : System.Web.Configuration.FormsAuthenticationCredentials
Public ReadOnly Property Credentials As FormsAuthenticationCredentials
プロパティ値
ユーザー名とパスワードが格納される FormsAuthenticationCredentials コレクション。
- 属性
例
Credentials プロパティへのアクセス方法を次のコード例に示します。 セクションを取得する方法については、クラス トピックの FormsAuthenticationConfiguration コード例を参照してください。
// Get the current Credentials.
FormsAuthenticationCredentials currentCredentials =
formsAuthentication.Credentials;
StringBuilder credentials = new StringBuilder();
// Get all the credentials.
for (System.Int32 i = 0; i < currentCredentials.Users.Count; i++)
{
credentials.Append("Name: " +
currentCredentials.Users[i].Name +
" Password: " +
currentCredentials.Users[i].Password);
credentials.Append(Environment.NewLine);
}
' Get the current Credentials.
Dim currentCredentials _
As FormsAuthenticationCredentials = _
formsAuthentication.Credentials
Dim credentials As New StringBuilder()
' Get all the credentials.
Dim i As System.Int32
For i = 0 To currentCredentials.Users.Count - 1
credentials.Append(("Name: " + _
currentCredentials.Users(i).Name + _
" Password: " + _
currentCredentials.Users(i).Password))
credentials.Append(Environment.NewLine)
Next i
注釈
このプロパティは Credentials 、フォーム ベースの認証時に使用するユーザー名とパスワードを取得します。
注意
セキュリティが必要な場合は、ユーザー名とパスワードを保存する別の方法を使用する必要があります。たとえば、データベース ストア内などです。 このコレクションを使用する場合は、指定された暗号化機能を使用する必要があります。