Tag Info

New answers tagged

2

There are many ways to get logged in user name SPWeb site = SPControl.GetContextWeb(Context); SPUser user = site.CurrentUser; string strUserName = user.LoginName; or you can use SPWeb web = SPControl.GetContextWeb(this.Context); string userName = web.CurrentUser.LoginName; or you also can use string userName = this.Context.User.Identity.Name;


2

You can use JSOM by javascript like two different ways: Using sp.js _spPageContextInfo.userLoginName Or you could use REST function getCurrentUser() { var endpointUrl = _spPageContextInfo.webServerRelativeUrl + '/_api/web/currentuser'; return $.ajax({ url: endpointUrl, method: "GET", contentType: ...



Top 50 recent answers are included