我已經看到很多與此類似的問題。但是,我還沒有找到解決我的問題的答案。退出按鈕後點擊後仍然顯示頁面asp.net mvc 3
我有一個註銷按鈕,我用Session.Abandon()和Session.Clear()來清除會話。它工作正常。但是,無論何時我點擊瀏覽器上的後退按鈕,頁面仍然顯示。但是,它應該顯示登錄表單,因爲用戶已經註銷。
控制器:
[HttpPost]
public ActionResult LogOut()
{
Session.Clear();
Session.Abandon();
return RedirectToAction("Index", "LogIn");
}
如何解決這個問題。任何建議高度讚賞。提前致謝。
您是否使用'Authorize'屬性檢查您的操作中的授權? http://msdn.microsoft.com/en-us/library/system.web.mvc.authorizeattribute.aspx – juanreyesv
@juanreyesv:不,我這樣檢查: 嘗試 { connect = connection.getConnection(); model = new Models.Entities(connect); connect.Open(); connect.Close(); } catch { return RedirectToAction(「Index」,「LogIn」); }。應該做什麼而不是做這個?謝謝。 – user3462803