[英]Get user credentials from Sharepoint Active Directory then use it in ASP.Net
嗨,我想問一下是否有可能將用戶憑據從Sharepoint Active Directory獲取到ASP.net。
您可以像這樣使用客戶端對象模型(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());
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.