2013-06-26 61 views

回答

0

要註銷,您必須使用註銷方法創建自定義控制器。

public void Logout() 
{ 
    // You should be able to revoke thinktecture token like this. (haven't tested this out) 
    var sam = FederatedAuthentication.SessionAuthenticationModule; 
    sam.SignOut(); 

    // Or you should be able to logoff like this when using a membership provider. (this way works for me) 
    //_yourMembership.Logout(); 
    Thread.CurrentPrincipal = null; 
    HttpContext.Current.User = null; 
} 

這裏是令牌撤銷的樣品: https://github.com/brockallen/BrockAllen.MembershipReboot/blob/master/src/BrockAllen.MembershipReboot/Authentication/SamAuthenticationService.cs