ASP.NET中的Session.Abandon问题 [英] Session.Abandon problem in asp.net
问题描述
大家好
我正在使用asp.net 2.0.我已经开发了Web应用程序.
我遇到Session.Abandon()
的问题
此方法在我的本地计算机上工作正常,但是当我将其部署到IIS并按LOGOUT时.它会挂起浏览器,并且什么也不做?
这是我使用的代码
Hi all
i am using asp.net 2.0. I have develop web application.
i have problem for Session.Abandon()
this method works fine on my local machine but when i deployed it to IIS, and press LOGOUT. it will hangs browser and does nothing what should i do ?
Here is the code that i used
Session.Clear()
Session.Abandon()
Response.Redirect("../../Default.aspx")
谷歌搜索建议我删除Session.Clear()
,但问题仍然存在.
在此先感谢您
Googling suggest me to remove Session.Clear()
but problem continues.
Thanks in advance
推荐答案
放弃会话时您还在安全区域内吗?服务器可能正在尝试交付用户不再有权接收的页面.
让注销按钮执行Response.Redirect("PageOutsideSecureArea.aspx")
,该页面放弃您的会话.然后,该页面可以自动重定向到您的默认页面,或者显示一个礼貌的您已经注销"消息和指向主页的链接(IMO是更好的设计.)
Are you still within your secured area when you abandon your session? It might be that the server is trying to deliver a page that the user no longer has permission to receive.
Have the log out button execute aResponse.Redirect("PageOutsideSecureArea.aspx")
, with that page abandoning your session. The page can then either automatically redirect to your default page, or have a polite "You have been logged out" message and a link to the home page (which, IMO, is better design.)
您可以尝试使用类似的方法:
You can try something like this instead:
Session.Contents.Remove("yoursessionid");
Response.Redirect("http://mysite.com/Default.aspx")
您可能会想出一种方法来正确解析路径(在对Response.Redirect
的调用中),以便该路径可同时在您的开发箱和已部署的网站上使用
You''ll probably want to figure out a way to properly resolve the path (in the call to Response.Redirect
) so that it works on both your dev box and your deployed web site
这篇关于ASP.NET中的Session.Abandon问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!