FormsAuthenticationModule 클래스

정의

Sets 폼 인증이 활성화될 때 ASP.NET 애플리케이션의 사용자 ID를 설명합니다. 이 클래스는 상속될 수 없습니다.

public ref class FormsAuthenticationModule sealed : System::Web::IHttpModule
public sealed class FormsAuthenticationModule : System.Web.IHttpModule
type FormsAuthenticationModule = class
    interface IHttpModule
Public NotInheritable Class FormsAuthenticationModule
Implements IHttpModule
상속
FormsAuthenticationModule
구현

예제

다음 예제에서는 합니다 FormsAuthentication_OnAuthenticate 이벤트가 설정 합니다 User 속성이 현재 HttpContext 을 사용자 지정 IPrincipal 개체입니다.

public void FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs args)
{
  if (FormsAuthentication.CookiesSupported)
  {
    if (Request.Cookies[FormsAuthentication.FormsCookieName] != null)
    {
      try
      {
        FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(
          Request.Cookies[FormsAuthentication.FormsCookieName].Value);
        
        args.User = new System.Security.Principal.GenericPrincipal(
          new Samples.AspNet.Security.MyFormsIdentity(ticket),
          new string[0]);
      }
      catch (Exception e)
      {
        // Decrypt method failed.
      }
    }
  }
  else
  {
    throw new HttpException("Cookieless Forms Authentication is not " +
                            "supported for this application.");
  }
}
Public Sub FormsAuthentication_OnAuthenticate(sender As Object, _
                                              args As FormsAuthenticationEventArgs)
  If FormsAuthentication.CookiesSupported Then
    If Not Request.Cookies(FormsAuthentication.FormsCookieName) Is Nothing Then
      Try
        Dim ticket As FormsAuthenticationTicket = FormsAuthentication.Decrypt( _
          Request.Cookies(FormsAuthentication.FormsCookieName).Value)
        
        args.User = New System.Security.Principal.GenericPrincipal( _
          New Samples.AspNet.Security.MyFormsIdentity(ticket), _
          New String(0) {})
      Catch e As HttpException
        ' Decrypt method failed.
      End Try
    End If
  Else
      Throw New Exception("Cookieless Forms Authentication is not " & _
                            "supported for this application.")
  End If
End Sub

설명

FormsAuthenticationModule 에서는 현재 HttpContext.User 속성을는 IPrincipal 현재 사용자 id를 나타내는 개체를 요청 하는 경우 인증 Mode 로 설정 되어 Formsauthentication 요소 (ASP.NET 설정 스키마) 애플리케이션의 구성 파일의 요소입니다.

합니다 FormsAuthenticationModule 노출를 Authenticate 사용자 지정을 제공할 수 있도록 하는 이벤트 IPrincipal 개체에 대 한 합니다 User 속성이 현재 HttpContext합니다. 합니다 Authenticate 라는 서브루틴을 지정 하 여 액세스 하는 이벤트 FormsAuthentication_OnAuthenticate ASP.NET 애플리케이션의 Global.asax 파일에 있습니다.

참고

사용 하 여 IIS 7.0에에서는 WindowsAuthenticationModule 사용 하 여는 FormsAuthenticationModule 지원 되지 않습니다. 통합된 모드의 호환성 문제에 대 한 자세한 내용은 참조 하세요. IIS 6.0에서 IIS 7.0 ASP.NET 애플리케이션 이동합니다.

생성자

FormsAuthenticationModule()

FormsAuthenticationModule 클래스의 새 인스턴스를 초기화합니다.

메서드

Dispose()

FormsAuthenticationModule에서 사용하는 모든 리소스(메모리 제외)를 해제합니다.

Equals(Object)

지정된 개체가 현재 개체와 같은지 확인합니다.

(다음에서 상속됨 Object)
GetHashCode()

기본 해시 함수로 작동합니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
Init(HttpApplication)

초기화는 FormsAuthenticationModule 개체입니다.

MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

이벤트

Authenticate

애플리케이션이 현재 요청을 인증할 때 발생합니다.

적용 대상

추가 정보