如何保护Asp.Net中的注销 [英] How to Secure Logout in Asp.Net

查看:71
本文介绍了如何保护Asp.Net中的注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Asp.Net中确保注销?

How to Secure Logout in Asp.Net?

推荐答案

如果您是说,如何进行注销以使用户注销,则存储是否已注销.在会话中注销,然后关闭缓存,以使它们无法使用浏览器历史记录返回到登录页面.
If you mean, how to make your logout so the user is logged out, you store if they are logged out in the session, and you turn off caching so they cannot go back to the logged in page they were on using the browser history.


Session.Clear();
Response.Cache.SetNoStore();
Response.Redirect("../Default.aspx"); //登录页面网址听到
Session.Clear();
Response.Cache.SetNoStore();
Response.Redirect("../Default.aspx"); // login page url hear


尝试一下.
放置一个注销按钮.或链接按钮..然后双击该按钮/链接按钮并使用此代码..
try this.
place one logout button. or link button..then double click on that button/link button and use this code..
protected void lbtnLogOut_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("Login.aspx");
    }


希望对你有帮助.
谢谢


hope it will help u..
thanks


这篇关于如何保护Asp.Net中的注销的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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