Get username according to userid & use username on separate web forms in website ? RRS feed

  • Question

  • User-726271228 posted

    hi to all . i 'm creating a website. i create a login form. after login my session will be start and all page of user profile will check first is session istart. i have stored userid in session for identify user. But i want to username of that userid. Remaiber username and userid are different. and i want to show only username on welcome tab. 

    e.g.  userid= rksaini89

           username= ramkrishn

    so i want to show like this "welcome ramkrishn" on my home page and other many places on different forms.

    my confusion is that how to get username acording userid and where to keep store it. 

    i can get it from database according session but i'm confused where to keep it so i can use it everywhere on my website...??

    Sunday, October 3, 2010 5:30 AM


  • User1224940435 posted


    Get UserName from DataBase and store it on Session object.


    1. UseRID = 1000

    2. Get UserName from DataBase where UserID = 1000

    3. Session["UserMame"] = your Username from database So you can use it in wevery page for particular user session.

    Another way to is to user "ProfileManager" which is part of MemberShip of ASP.net.  Which store extra information for each user.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, October 3, 2010 7:31 AM