Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/429.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 退出后返回按钮问题_C#_Javascript_Jquery_Html_Asp.net - Fatal编程技术网

C# 退出后返回按钮问题

C# 退出后返回按钮问题,c#,javascript,jquery,html,asp.net,C#,Javascript,Jquery,Html,Asp.net,我已经浏览了一些链接,花了几个小时,但我的页面在单击“上一步”按钮注销后仍会加载。这是我尝试的注销页面代码 protected void Page_Load(object sender, EventArgs e) { if(Session[Constants.KeyValues.UserProfileSession]== null) { Response.Redirect("www.google.com", true); }

我已经浏览了一些链接,花了几个小时,但我的页面在单击“上一步”按钮注销后仍会加载。这是我尝试的注销页面代码

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);
    }
以下是我尝试过的链接

,

,

,

,


尝试使用此功能,它适用于所有浏览器

    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.

您需要更改的不是注销页面的可缓存性,而是要返回的页面的可缓存性。该页面上的缓存头是什么?我不希望用户在注销后重定向到成员页面。我不能禁用后退按钮,但可以清除浏览器的捕获。或者任何其他方法来实现我的目标。@Tim:我添加了当我们单击“上一步”按钮时加载的页面代码。但该页来自缓存,因此无法检查会话空值。@lovethakker首次加载该页时,缓存头是什么?如果浏览器缓存了该页面,则无论您在注销页面上设置了什么缓存头,它都不会影响任何其他页面。@Tim:我正在注销页面中的所有页面中添加元标记。但我仍然无法将它们从缓存中删除。团队:没有任何进展。你能给我一些建议吗?我已经读过这篇文章了。我已经在我的页面中实现了它。它工作得很好。唯一需要记住的一点是->不要通过页面加载重定向。谢谢
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);
     }  }
    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.