Я пытаюсь остановить отображение Active Directory определенной учетной записи, относящейся к групповому тестированию.например, я не хочу отображать SamAccountName = "Пользователи Doman"
C #
public ActionResult Index(string username)
{
username = "test";
string[] output = null;
// username = sssftappdev;
using (var ctx = new PrincipalContext(ContextType.Domain))
using (var user = UserPrincipal.FindByIdentity(ctx, username))
{
if (user != null)
{
output = user.GetGroups()
.Select(x => x.SamAccountName)
.ToArray();
}
}
return View(output);
}
View
<table id="tbldirectory" class="table table-striped table-bordered table-hover"> <thead>
<tr>
<th></th>
<th>
@Html.Label("Group Name")
</th>
</tr>
</thead>
<tbody>
@foreach (var output in Model)
{
<tr>
<th>
@Html.ActionLink("View", "Index", "ActiveDirectoryMember", new { id = output }, new { @class = "btn btn-xs btn-primary" }) |
</th>
<th>@output</th>
</tr>
}
</tbody>
</table>