Riddhi Valecha

Riddhi Valecha

  • 444
  • 3.3k
  • 412.7k

Difference - Ways to get current logged in user

Feb 3 2015 6:16 AM
Hi all...

My question is -

What is the difference between -

1. Page.User.Identity.Name

2. HttpContext.Current.User.Identity.Name.ToString();

3. System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();

4.System.Environment.UserName;
-----------
Which is the best method to get the current logged in username for all Single Sign On Applications ??
------------
Which statement is to be used in which scenario ??
-------
Please explain.

Answers (8)