您好我想问一下是否可以从Sharepoint Active Directory获取用户凭据到ASP.net。
答案 0 :(得分:0)
您可以使用客户端对象模型(CSOM)使用javascript获取当前登录用户...
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());
}