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 sort of impersonation. But, am not sure how to achieve this. Any insights?
this was answered in a previous post.
SPContext.Current.Web.CurrentUser returns misleading value