Search code examples
asp.netasp.net-membershipuserid

How can I get UserName or UserId from loginName control?


I'm wondering is there any way i could get UserName or UserId for current User from LoginName control in ASP.NET ?


Solution

  • You could use the User property of the Page class:

    string userName = Page.User.Identity.Name;