如何结束会话,并确保注销过程是正确的? [英] How to end the session and make sure the logged out process is correct?
问题描述
我是新来的.aspx现在的事情是因为我做了网络功能的项目,我有一个从用户登入。我拖累下跌登录模板,然后用
会话[验证] = username.Tostring();
存储当前登录用户的信息等。现在,我竟然用在右上角的超链接注销,然后使其转移到登录页面。 (如果是转校错误的方式请让我知道,我学习所有网络)。
现在,如果上运行的网络,我可以轻松地登录,但是当我通过超链接注销退出,它会带我到登录页面了,但如果我再次preSS的浏览器,它的返回按钮传输控制数据页,我可以再次进行数据操作的。
我用这个
会话[身份验证] = NULL
在登录页面的页面加载,因此只有在登录点击链接,用户可以通过
再次输入 会话[身份验证] = username.Tostring();
然后我用一张支票在数据页,每页页面加载
如果(会话[Authentiacte] == NULL)
Server.Tranfer(LoginPage.aspx);
这剪掉解决我的问题,
请任何人都可以给出提示或链接或提高我的退出方式小费了吗?
我strated这个项目没有.NET或ASPX的任何知识,我还在学习的一切,请把我的疑惑
thankx提前..
HttpContext.Current.Session.Clear();
HttpContext.Current.Session.Abandon();
HttpContext.Current.User = NULL;
System.Web.Security.FormsAuthentication.SignOut(); //如果窗体身份验证使用
I am new to .aspx and now the thing is since i am doing a web enabled project, I have this login from an user. I drag dropped the login template and then used the
Session["Authentication"] = username.Tostring();
to store the current logged user's info and so. Now i even used a hyperlink "Logout" at the top right corner and then made it transfer to Login page. ( If this is wrong way of transfering Please Let me know, I am Learning all by internet)..
Now if on running the web , i can easily login , but when i logout through hyper link "logout" it will take me to the Login page again, but if i press the back button of the browser it again transfers the control to the data page and i can again perform the data operation's.
I used this
Session["Authenticate"] = null
at the page load of the login page so that only at the login button click the user can enter again by
Session["Authenticate"] = username.Tostring();
Then i used a check at each page load of the data pages
if(Session[Authentiacte"] == null)
Server.Tranfer("LoginPage.aspx");
This didnt solve my problem, Please can anyone give a hint or a link or a tip to improve my way of logout? I strated this project without any knowledge of the .net or aspx and i am still learning everything, please bare my doubts thankx in advance..
HttpContext.Current.Session.Clear();
HttpContext.Current.Session.Abandon();
HttpContext.Current.User = null;
System.Web.Security.FormsAuthentication.SignOut(); // if forms auth is used
这篇关于如何结束会话,并确保注销过程是正确的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!