Butters
Butters

Reputation: 1057

c# get client username

I'm trying to get my logged username of my client, but I get still server-information. This are my trys:

Environment.UserName;
System.Security.Principal.WindowsIdentity.GetCurrent().User;
System.Security.Principal.WindowsIdentity.GetCurrent().Name;
System.Net.Dns.GetHostName();
Request.ServerVariables["REMOTE_ADDR"];
Request.UserHostAddress;

Upvotes: 0

Views: 3634

Answers (1)

Ron Thacker
Ron Thacker

Reputation: 191

Typically I use User.Identity.Name, which returns the login name the user accessing the application enters.

e.g.var loginName = User.Identity.Name;

Upvotes: 1

Related Questions