Obtaining actual login name for System admins - SharePoint
I am developing a webpart in SharePoint. I am using windows authentication for logging into any of my web applications. I need to obtain the actual login name of the currently logged in user. I know that it could be obtained easily by SPContext.Current.Web.CurrentUser.LoginName.
But, the pitfall here is that if at all am logged in as the administrator of the machine, Sharepoint parses the login name as SharePoint\System instead of the original login name(let us say domainname\steve).
The only alternative I could see here is revoke the administrative rights for the user by some sor开发者_如何学运维t of impersonation. But, am not sure how to achieve this. Any insights?
this was answered in a previous post.
HttpContext.Current.Request.ServerVariables["AUTH_USER"];
SPContext.Current.Web.CurrentUser returns misleading value
精彩评论