My.User.Name vs My.User.CurrentPrincipal.Identity.Name

I found that both My.User.Name and My.User.CurrentPrincipal.Identity.Name return the Windows login ID for the user to log on to the computer. However, is there a difference between the two? Will there ever be a case when they do not return the same value?

+3
source share
2 answers

The information on the My.UserMSDN page best describes these values ​​and when they differ.

Finally. The biggest difference between Windows and web applications.

Windows , CurrentPrincipal. - , , .

+2

System.Web.UI.Page, :

  • Me.User Me.Context.User;
  • Me.Context HttpContext.Current

, .

Oops! . My " " , User . - .

+2

Source: https://habr.com/ru/post/1763812/


All Articles