다음을 통해 공유


FormsAuthenticationConfiguration.Protection 속성

정의

쿠키를 암호화하는 데 사용되는 암호화 유형을 가져오거나 설정합니다.

public:
 property System::Web::Configuration::FormsProtectionEnum Protection { System::Web::Configuration::FormsProtectionEnum get(); void set(System::Web::Configuration::FormsProtectionEnum value); };
[System.Configuration.ConfigurationProperty("protection", DefaultValue=System.Web.Configuration.FormsProtectionEnum.All)]
public System.Web.Configuration.FormsProtectionEnum Protection { get; set; }
[<System.Configuration.ConfigurationProperty("protection", DefaultValue=System.Web.Configuration.FormsProtectionEnum.All)>]
member this.Protection : System.Web.Configuration.FormsProtectionEnum with get, set
Public Property Protection As FormsProtectionEnum

속성 값

열거형 값 중 FormsProtectionEnum 하나입니다. 기본값은 All입니다.

참고 데이터 유효성 검사와 암호화를 모두 사용하여 쿠키를 보호하려면 이 속성의 기본값을 사용해야 합니다. 이 옵션은 을 기반으로 구성된 데이터 유효성 검사 알고리즘을 machineKey사용합니다. Triple-DES(3DES)는 암호화에 사용되며, 사용 가능한 경우 키가 충분히 긴 경우(48바이트 이상)

쿠키 보호를 개선하기 위해 다음으로 설정할 RequireSSLtrue수도 있습니다.

특성

예제

다음 코드 예제에서는 속성에 액세스 하는 방법을 보여 있습니다 Protection . 섹션을 가져오는 방법을 알아보려면 클래스 항목의 FormsAuthenticationConfiguration 코드 예제를 참조하세요.

// Get the current Protection.
FormsProtectionEnum currentProtection =
    formsAuthentication.Protection;

// Set the Protection property.
formsAuthentication.Protection =
    FormsProtectionEnum.All;
' Get the current Protection.
Dim currentProtection As FormsProtectionEnum =
formsAuthentication.Protection

' Set the Protection property.
formsAuthentication.Protection = FormsProtectionEnum.All

적용 대상

추가 정보