如何检查登录的用户? [英] how to check that which user is logged-in?

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

问题描述



我正在开展一个虚拟项目,用C#在asp.net上练习。我是这些语言的新手。我想知道如何检查登录的用户。实际上我做了一个登录和注册页面。用户登录后,他将被定向到名为个人资料页面的新页面。我在这里做了手风琴。其中一个名为基本信息的手风琴具有与用户在注册时输入相同的信息(名字,姓氏,电子邮件等)。我希望该用户不应再次输入这些信息,它应该自动从DB进行。任何人都可以告诉我该怎么做?记住我是ASP.NET和C#.thanx的新手。

Hi,
i am working on a dummy project to get practice in asp.net with C#. i am new in these languages. i want to know that how to check that which user is logged-in. actually i made a login and registration page. after user get logged in, he is directed to new page called profile page. here i made accordians. one of the accordian called "Basic info" has the same same info that user enter while registering himself (first name,last name , email ....etc). i want that user should not enter these info again it should be automatically there from DB. can any one please tell me how to do it? Remember i'm new in ASP.NET and C#.thanx.

推荐答案

您只想将值存储到Session中。在您的登录代码中,在您确认他们是有效用户后,您可以执行以下操作:



You just want to store the value into the Session. In your login code, after you have verified they are a valid user you can do something like:

Session["EmailAddress"] = emailAdress;





然后您可以通过以下方式轻松使用它:



And then you can use it later on easily by:

lblEmailAddress.Text = Session["EmailAddress"];


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

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