tags:

views:

47

answers:

2

I've found that both My.User.Name and My.User.CurrentPrincipal.Identity.Name both return the Windows login ID of the user logged in to the PC. However, is there a difference between the two? Will there ever be a case where they won't return the same value?

+2  A: 
Rex M
OP say `My` which is very different than `Me`
JaredPar
+2  A: 

The information on the My.User MSDN page has the best summary of these values and when they differ

In summary though. The biggest difference occurs between Windows and Web Applications.

For Windows applications, this property provides the same functionality as the CurrentPrincipal property. For Web applications, this property provides the same functionality as the User property of the object returned by the Current property.

JaredPar
Thanks. Since I'm using this in a Windows application, I can rest assured that they are the same - and that I can use the shorter of the two :)
HardCode