ClientFormsAuthenticationMembershipProvider.Logout 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
사용자를 로그아웃합니다.
public:
void Logout();
public void Logout ();
member this.Logout : unit -> unit
Public Sub Logout ()
예외
IsOffline 속성 값이 false
인데 멤버 자격 공급자가 인증 서비스에 액세스할 수 없는 경우
예제
다음 예제 코드는 사용자를 로그 아웃 하려면이 메서드를 사용 하는 방법에 설명 합니다.
private void logoutButton_Click(object sender, EventArgs e)
{
SaveSettings();
ClientFormsAuthenticationMembershipProvider authProvider =
(ClientFormsAuthenticationMembershipProvider)
System.Web.Security.Membership.Provider;
try
{
authProvider.Logout();
}
catch (WebException)
{
MessageBox.Show("Unable to access the authentication service." +
Environment.NewLine + "Logging off locally only.",
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
ConnectivityStatus.IsOffline = true;
authProvider.Logout();
ConnectivityStatus.IsOffline = false;
}
Application.Restart();
}
Private Sub logoutButton_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles logoutButton.Click
SaveSettings()
Dim authProvider As ClientFormsAuthenticationMembershipProvider = _
CType(System.Web.Security.Membership.Provider, _
ClientFormsAuthenticationMembershipProvider)
Try
authProvider.Logout()
Catch ex As WebException
MessageBox.Show("Unable to access the authentication service." & _
Environment.NewLine & "Logging off locally only.", _
"Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
ConnectivityStatus.IsOffline = True
authProvider.Logout()
ConnectivityStatus.IsOffline = False
End Try
Application.Restart()
End Sub
설명
Logout 메서드는 쿠키 캐시에서 모든 인증 쿠키를 지우고 다시 설정 합니다 static
Thread.CurrentPrincipal 속성을를 WindowsPrincipal 현재 포함 된 개체 WindowsIdentity합니다.
이 메서드를 호출 하면 현재 사용자는 더 이상 클라이언트 애플리케이션 서비스에 대해 인증 됩니다. 즉, 역할을 통해를 검색할 수 없습니다는 ClientRoleProvider 클래스를 통해 및 설정의 ClientSettingsProvider 클래스입니다. 그러나 사용자 유효한 Windows id를 가질 수 있으므로 여전히 나타날 수 있습니다는 true
다음과 같은 코드의 값: Thread.CurrentPrincipal.Identity.IsAuthenticated
합니다. 클라이언트 애플리케이션 서비스에 대 한 사용자가 인증 되었는지 여부를 확인 하려면 있는지를 확인 합니다 Identity 속성 값을 IPrincipal 검색할를 static
CurrentPrincipal 속성이 ClientFormsIdentity 참조. 그런 다음 확인을 ClientFormsIdentity.IsAuthenticated 속성입니다.
현재 사용자 재인증을 호출 합니다 ClientFormsAuthenticationMembershipProvider.ValidateUser 메서드 또는 static
Membership.ValidateUser 메서드.
적용 대상
추가 정보
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기