我想在登录页面中进行安全编码 [英] i want securty coding in a login page

查看:107
本文介绍了我想在登录页面中进行安全编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完成了登录页面,但是我复制了该地址并粘贴了另一个选项卡,例如,该页面位于同一页面,
本地主机:1288/xxx/purch.aspx
(如果我复制到同一链接并粘贴另一个选项卡,则它是主屏幕. u 有人可以帮助我吗?

I finished login page but I copied that address and paste another tab, it was coming the same page, for example,
localhost:1288/xxx/purch.aspx
(If I''m copy to the same link and paste another tab,it was comin[g] home screen. Can u you anyone help me?

推荐答案

使用Session解决问题.
示例:
在您的情况下,每个用户名都有一个唯一的ID.将该ID放入Session之类的
Use Session to solve the problem.
Example:
In your case for every user name has a unique ID. Put that ID in a Session like
Session["UserId"] = userid.ToString();


成功登录后.
签入登录页面:


When successfully logged in.
Check in the login page:

if(Session["UserId"] != null)
{
   redirect to another page.
}



当您注销 u 时,请使用以下行放弃(终止)Session.



When u you logout use the below line to abandon(terminate) the Session.

HttpContext.Current.Session.Clear();
HttpContext.Current.Session.Abandon();


这篇关于我想在登录页面中进行安全编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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