如何识别用户登录登录页面 [英] how to identify whcih user has login the login page

查看:76
本文介绍了如何识别用户登录登录页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数据库中如下



用户名密码有效



Ram 123 A

Sam 234 B





在设计页面中如下



用户名文本框1

密码textbox2





在运行模式下如果Ram已登录登录页面我想要在文本框3中显示Ram名称。



bcoz我想确定哪个用户登录了登录页面。





我怎样才能使用asp.net c#。

问候,

Narasiman P.

in database as follows

Username Password Active

Ram 123 A
Sam 234 B


In design page as follows

Username textbox1
password textbox2


in run mode if Ram has login the login page i want to display Ram Name in textbox3.

bcoz i want to identify which user has login the login page.


how can i do using asp.net c#.
Regards,
Narasiman P.

推荐答案

一种简单的方法是将用户名存储在Session变量中。在您的代码验证用户之后,您将其用户名存储在会话中,然后您可以将其写入文本框。它非常简单并且一直都在完成。



An easy way is to store the username in a Session variable. After your code validates the user you then store their username in the session and then you can write that to a textbox. It's very simple and is done all the time.

Session["UserName"] = userName;  // store the username in the session
...

lblUserName.Text = Session["UserName"]; // put their username into a label

这篇关于如何识别用户登录登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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