다음을 통해 공유


FormsAuthenticationConfiguration.Credentials 속성

정의

사용자 이름과 암호가 포함된 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

사용자 이름과 암호가 포함된 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 속성의 사용자 이름 및 폼 기반 인증 중에 사용할 암호를 가져옵니다.

참고

보안이 필요한 경우 사용자 이름 및 암호를 저장 하는 다른 방법을 사용 해야 예를 들어 데이터베이스에 저장 합니다. 이 컬렉션을 사용 하려는 경우 제공된 된 암호화 기능을 사용 해야 합니다.

적용 대상