简体   繁体   中英

Get user credentials from Sharepoint Active Directory then use it in ASP.Net

嗨,我想问一下是否有可能将用户凭据从Sharepoint Active Directory获取到ASP.net。

You can get the current logged in user with javascript using the Client Side Object Model (CSOM) like this...

function CSOM()
{
  var context = new SP.ClientContext.get_current();
  this.website = context.get_web();
  this.currentUser = website.get_currentUser();
  context.load(currentUser);
  context.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}



function onQuerySucceeded(sender, args)
 {
   alert("Current User: " + currentUser.get_loginName());
 }



function onQueryFailed(sender, args)
{
  alert('Unable to get current user ' + args.get_message() + '\n'+ args.get_stackTrace());
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM