使用asp.net保护c#注销的代码 [英] code to secure logout in c# using asp.net
问题描述
我使用以下代码注销我的项目
protected void LinkButton11_Click(object sender,EventArgs e)
{
Session.Abandon();
Session.Clear();
Response.Redirect(LOGIN .aspx,true);
}
我想阻止用户查看以前的内容注销后使用Back
按钮的页面。我希望显示此页面已过期。
我该怎么做?但我不能通过这段代码来做...
我错过了什么或做错了什么?
< blockquote>清理缓存可能有帮助。
在页面加载时尝试这个 -
Response.Cache.SetAllowResponseInBrowserHistory( False )
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetExpires(Now()。AddSeconds(-1))
响应。 Cache.SetNoStore()
Response.AddHeader( Pragma, no-cache)
Response.Write( & DateTime.Now.ToLongTimeString())
I am using the below code to log out in my project
protected void LinkButton11_Click(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();
Response.Redirect("LOGIN.aspx",true);
}
I want to prevent the user from viewing the previous page using the Back
button after logout. I want to instead show that this page has expired.
How do I do this? but I cant do it by this code...
What am I missing or doing wrong?
Clean the cache might help.
Try this on page load -
Response.Cache.SetAllowResponseInBrowserHistory(False) Response.Cache.SetCacheability(HttpCacheability.NoCache) Response.Cache.SetExpires(Now().AddSeconds(-1)) Response.Cache.SetNoStore() Response.AddHeader("Pragma", "no-cache") Response.Write("" & DateTime.Now.ToLongTimeString())
这篇关于使用asp.net保护c#注销的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!