2014-08-28 2 views
0

링크를 통해 몇 시간을 보냈지 만 뒤로 버튼을 클릭하면 로그 아웃 한 후 내 페이지가 계속로드됩니다. 여기에 내가 시도한 로그 아웃 페이지 코드가있다.뒤로 버튼 로그 아웃 후 문제

protected void Page_Load(object sender, EventArgs e) 
    { 
    if(Session[Constants.KeyValues.UserProfileSession]== null) 
    { 
      Response.Redirect("www.google.com", true); 
    }   

     ////Clear cookie and redirect user to login page (Landing page before login). 
     Response.AddHeader("pragma", "no-cache"); 
     Response.AddHeader("cache-control", "private"); 
     Response.CacheControl = "no-cache"; 
     Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1)); 
     Response.Cache.SetCacheability(HttpCacheability.NoCache); 
     Response.Cache.SetNoStore(); 
     FormsAuthentication.SignOut(); 
     Response.Cookies.Clear(); 

     HttpContext.Current.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1)); 

     HttpContext.Current.Response.Cache.SetValidUntilExpires(false); 
     HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); 
     HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); 
     HttpContext.Current.Response.Cache.SetNoStore(); 


     Session.Clear(); 
     Session.Abandon(); 
     Session[Constants.KeyValues.UserProfileSession] = null;    
     Response.Write("<script type=\"text/javascript\">window.location.replace('www.google.com');</script>"); 
     //Response.Redirect("www.google.com", true); 
    } 

여기 여기 내 html 페이지

<!doctype html> 
<html lang="ko"> 
<head> 
    <title></title> 
    <meta http-equiv="Cache-Control" content="no-cache" /> 
    <meta http-equiv="Pragma" content="no-cache" /> 
    <meta http-equiv="Expires" content="0" /> 
    <script type="text/javascript"> 
     function ClearHistory() { 
      var backlen = history.length; 
      history.go(-backlen); 
      window.location.href = www.google.com 
     } 
    </script> 
</head> 
<body onload="ClearHistory();"> 
</body> 
</html> 

입니다 회원 로그인 후 이동 페이지로드의 코드

protected void Page_Load(object sender, EventArgs e) 
    { 
    if(Session[Constants.KeyValues.UserProfileSession]== null) 
    { 
      Response.Redirect(SPContext.Current.Site.Url + "/_layouts/ABC/ShoppingLandingBeforeLogin.aspx", true); 
    } } 

여기에 내가 시도 링크가 있습니다.

How to clear browser cache when user log off in asp.net using c#? ,

How to prevent browser and proxy caching of web pages

Browser back button issue after logout

,

Clear History using javascript

, 이것을 사용하는

back-button-of-browser-issue-in-asp-net-logout

+0

무엇이 문제입니까? –

+0

변경해야하는 로그 아웃 페이지의 캐시 가능성이 아닙니다. 캐시하려는 페이지의 캐시 가능성입니다. 해당 페이지의 캐싱 헤더는 무엇입니까? –

+0

로그 아웃 후 사용자가 회원 페이지로 리디렉션하지 못하게하고 싶습니다. 뒤로 버튼을 사용 중지 할 수 없지만 브라우저의 캐치를 제거 할 수 있습니다. 또는 내 목표를 달성하기위한 다른 방법. –

답변

0

봅니다, 모든 브라우저에서 작동합니다.

Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. 
    Response.AppendHeader("Pragma", "no-cache"); // HTTP 1.0. 
    Response.AppendHeader("Expires", "0"); // Proxies. 
+0

팀 : 아무런 진전이 없습니다. 이 일에서 나를 도울 수있는 다른 것을 제안 할 수 있습니까? –

+0

나는 [back-button-issue-after-logout] 글을 읽었습니다. (http://geekswithblogs.net/Frez/archive/2010/05/18/back-button-issue-after-logout-in-asp.net) .aspx). 내 페이지에서 구현했습니다. 잘 작동한다. 유일한 기억 포인트는 -> 페이지로드를 통해 리디렉션되지 않습니다. 감사. –