Email/First Name and Last Name in ASP.Net Core Controller Side

asked 2022-06-27T06:58:55.097+00:00
Shatrughan Raghuwanshi 1 Reputation point

I am trying to get the E-Mail/First Name and Last Name on the Controller side of ASP.Net Web 

User Name i am getting via 

string UserName = HttpContext.User.Identity.Name;

But i am getting NULL in 

MailId = UserPrincipal.Current.EmailAddress;

FirstName = UserPrincipal.Current.GivenName;

LastName = UserPrincipal.Current.Surname;

Unfortunately our LDAP server is not providing the Mail Address 

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
2,527 questions
{count} votes