Lots of places use sharepoint.
How can we securely retrieve the logged on sharepoint user when they view our app inside a web part?
Lots of places use sharepoint.
How can we securely retrieve the logged on sharepoint user when they view our app inside a web part?
If your WebPart is running in SharePoint you can get the current user from the SPContext.
SPContext.Current.Web.CurrentUser.LoginName
Shane.
you need to be in the SharePoint context in order to get the SPUser object in code. Otherwise you could just try
Context.User.Identity.Name
But of course this will not the the AD name and not the SharePoint user.