Hii,
I want to get the User Name of my window form application in C# from the list of registered user name in my database Login list, not the Windows user name.
Please tell me.
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sunny SharmaRank #223 · 11.1K reputationPosted May 27, 2013, 9:30 PM EDT
Don't worry... please share your code what you've tried so far. I want to see how you've implemented the authentication to help you with.
Thanks.
Pankaj PandeyRank #642 · 3.7K reputationPosted May 27, 2013, 8:53 PM EDT
please explain your need a little more
Sunny SharmaRank #223 · 11.1K reputationPosted May 27, 2013, 8:58 PM EDT
William Anthony50 reputationPosted May 27, 2013, 9:09 PM EDT
Sunny SharmaRank #223 · 11.1K reputationPosted May 27, 2013, 9:18 PM EDT
As you said, you're using a database having login credentials. If I'm not wrong then the user name must be there. I suggest to assign it to a variable like "CurrentUser" at meantime you've successfully authenticated the user.
If you're using ASP.NET Memebership provider to provide Authentication and Authorization and want to get the current user name use the code below:
User.Identity.Name //it returns the currently logged in user name. FYI: "User" object belongs to System.Web.Security namespace. Please don;t forget to accept this as answer if it helps! Thanks.William Anthony50 reputationPosted May 27, 2013, 9:25 PM EDT
Thanks
Sunny SharmaRank #223 · 11.1K reputationPosted May 27, 2013, 9:36 PM EDT
William Anthony50 reputationPosted May 27, 2013, 9:44 PM EDT