Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IPrincipal or Membership to retrieve username

What is the difference when retrieving username for the view?

<%= Page.User.Identity.Name %>

or

<%= Membership.GetUser().UserName %>
like image 612
zsharp Avatar asked Jan 22 '23 17:01

zsharp


1 Answers

According to the documentation, GetUser gets the information from the data source and updates the last-activity date/time stamp for the current logged-on membership user.

Page.User.Identity.Name does not do that. It reads information that is readily available in memory.

like image 183
Klaus Byskov Pedersen Avatar answered Feb 04 '23 15:02

Klaus Byskov Pedersen