尽管使用Session.Abandon(),会话仍在工作 [英] Session Still Working Despite Using Session.Abandon()

查看:73
本文介绍了尽管使用Session.Abandon(),会话仍在工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..我使用 Session.Abandon()从页面注销,然后重定向到 Logout.aspx 。但是当我使用IE 8的 Back 按钮时,它会将我带回到我认为不应该的页面。这有什么问题? thnx

以下是我的工作

 Session.Abandon(); 
Response.Redirect(Logout.aspx);

解决方案

浏览器后退按钮不会重新加载页面,直到你强制它。它从缓存中获取代码,因此您可以再次查看最后一页。



此提示可以帮助您:注销后浏览器后退按钮问题 [ ^ ]


放这个在Logout页面的 PageLoad 方法中(我*认为*它可能会起作用):



< pre lang =cs> Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
Response.AppendHeader( Pragma no-cache);


您好



浏览此CP文章,在ASP.Net中探索会话 [ ^ ]。我希望这会清除你的所有疑问。



P.S:阅读完这篇文章后,分析你的自我,在这种情况下该怎么办。如果你没有为IE8的后退按钮找到解决方案,请在这里发表评论。



谢谢

Eswar

Hello guys.. Im using Session.Abandon() to logout from a page and then redirecting to Logout.aspx. But when I use the Back button of IE 8, it takes me back to that page which I think it should not. What is wrong with this?? thnx
Here is what I have done

Session.Abandon();
Response.Redirect("Logout.aspx");

解决方案

Browsers back button does not reload the page until you force it. It fetches the code from cache and hence you are able to view the last page again.

This tip should help you out: Browser back button issue after logout[^]


Put this in the PageLoad method of the Logout page (I *think* it might do the trick):

Response.Cache.SetCacheability(HttpCacheability.NoCache);   
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));   
Response.Cache.SetNoStore();   
Response.AppendHeader("Pragma", "no-cache"); 


Hi

Go through this CP Article, Exploring Session in ASP.Net[^]. I hope this will clear all your queries.

P.S: After reading of this article, Analyze your self, what have to do in this type of situations. Still if you didn''t get solution for your ''Back button of IE8'' post a comment here.

Thanks
Eswar


这篇关于尽管使用Session.Abandon(),会话仍在工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆