【发布时间】:2015-04-08 10:11:31
【问题描述】:
我有一个我要发布到的电子邮件确认控制器。
发生这种情况时,我需要注销,清除有关用户的会话和 cookie...这是因为当他们确认他们的电子邮件时,我需要一个按钮来让用户重新发送确认电子邮件。
我是这样做的:
[HttpPost]
[Authorize]
public async Task<ActionResult> ReSendEmailConfirmation(string userID)
{
await this.SendEmailConfirmation( userID );
//Log off to prevent stale user session
AuthenticationManager.SignOut( DefaultAuthenticationTypes.ApplicationCookie );
Session.Clear();
Session.Abandon();
Response.Cookies.Clear();
return RedirectToAction( "ReSendEmailConfirmation" ); // I am logged out okay, but when i goto my email... click the confirmation link, then log back in... it still says my email is not confirmed. If i shut my browser down, it will then update.
}
问题是即使在所有这些之后......
当我重新登录时,它仍然说电子邮件未确认...即使它在数据库中...
如何彻底清除用户会话?
【问题讨论】:
标签: asp.net-mvc session cookies