Using standard windows authentication I attempting to get the identity of the logged in user so I can update a value in a list that this webpart is interacting with.
I have tried:
SPWeb currentWeb = SPContext.Current.Web; SPUser currentUser = currentWeb.CurrentUser; return currentUser.ID;
Which only returns the SHAREPOINT\system account.
I have also tried this:
SPWeb web = SPContext.Current.Web; string loginName = System.Threading.Thread.CurrentPrincipal.Identity.Name SPUser user = web.EnsureUser(loginName);
the second line will always come up as an empty string.