New answers tagged spuser
I'll take a wild guess here and assume you are comparing user under elevated privileges. To get "true" user, you have to get him from SPContext. Something like int userID = SPContext.Current.Web.CurrentUser.ID; To get SHAREPOINT/System account you can use following code int systemID = SPContext.Current.Web.SystemAccount.ID; Then simply compare both ...
You can compare the user ID with the SystemAccount.ID Exemple : SPUser yourUser = 'your code here'; if (yourUser.ID == web.Site.SystemAccount.ID)
You can compare the token value of the account to determine if it is equal to the one of the system account. Note that in the following you get the SPSite object under elevated privileges and that comparing tokens only works when the actual account in SharePoint is already listed as the system account. SPUser user = <<your code here>> SPSite ...
Top 50 recent answers are included