简体   繁体   中英

retrieving data from database where username = session name in c#

I am working on a online website for asp 4.0 I got an problem. I have to display mobile no. and address of a user who have log in. Means from session name i have to match details and fetch from database and display it. But how to do that. Please reply I really need help.

You can get logged on user name from HttpContext

HttpContext.Current.User.Identity.Name

Prepare a select query to which you will pass the user name you got from above piece of code, apply appropriate filter criteria based on how you are storing user names in your database and fetch selected user details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM