8
Reply

Difference - Ways to get current logged in user

Riddhi Valecha

Riddhi Valecha

Feb 3 2015 6:16 AM
688
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)