我可能只是累了,看不出有什么问题,所以也许你们可以给我一个想法。
public class AuthTicket : IAuthTicket
{
#region IAuthTicket Members
public string CreateAuthenticationTicket(string userName, bool persistent, string userData)
{
var formsAuthenticationTicket = new FormsAuthenticationTicket(1, userName, DateTime.Now,
DateTime.Now.AddDays(5), persistent, userData,
FormsAuthentication.FormsCookiePath);
var encryptedTicket = FormsAuthentication.Encrypt(formsAuthenticationTicket);
return encryptedTicket;
}
#endregion
}
// This is injeted in the ctor
string authTicket = _authTicket.CreateAuthenticationTicket(userId.ToString(), true,
registerOpenIdUserViewModel.DisplayName);
Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName,authTicket));
return RedirectToAction("Index", "Home");在我的控制器操作中,我有部分@Html.ActionLink(“注销”," LogOff ",“帐户”)在LogOff的操作中,我只有FormsAuthentication.SignOut
这就是问题所在,SignOut没有删除AuthTicket,我仍然可以看到cookie,并且用户无法注销。:)很酷吧?
发布于 2011-05-20 00:01:02
我也有同样的问题。我只是在我的代码中手动强制删除cookie。
Roles.DeleteCookie( );https://stackoverflow.com/questions/6061447
复制相似问题