R
rote
I want users to be able to type a user name in a textox and when they hit
submit displays
groups the user belongs to from the Acive Directory.
the getGroupforUser uses the WindowsIdentity and i have a button even
below.
In the button event below i just want to send the username typed in in the
textbox but when i test the page i get error :-
"System.Security.SecurityException: The Kerberos subsystem encountered an
error. A service for user protocol request was made
against a domain controller which does not support service for user."
Any ideas??
List<string> getGroupsforUser(WindowsIdentity id)
{
List<string> groups = new List<string>();
IdentityReferenceCollection irc = id.Groups;
foreach (IdentityReference ir in irc)
{
NTAccount acc = (NTAccount)ir.Translate(typeof(NTAccount));
groups.Add(acc.Value);
}
return groups;
}
-----------------------------------------------------------------------------------
protected void LookupADBtn_Click(object sender, EventArgs e)
{
string username = aduser.Text;
Response.Write("You are logged in as " + username + " your GROUPS are: ");
//WindowsIdentity id = (WindowsIdentity)HttpContext.Current.User.Identity;
WindowsIdentity id = new WindowsIdentity(username);
foreach (string roles in getGroupsforUser(id))
{
Label1.Text += "<br>" + roles.ToString();
}
}
submit displays
groups the user belongs to from the Acive Directory.
the getGroupforUser uses the WindowsIdentity and i have a button even
below.
In the button event below i just want to send the username typed in in the
textbox but when i test the page i get error :-
"System.Security.SecurityException: The Kerberos subsystem encountered an
error. A service for user protocol request was made
against a domain controller which does not support service for user."
Any ideas??
List<string> getGroupsforUser(WindowsIdentity id)
{
List<string> groups = new List<string>();
IdentityReferenceCollection irc = id.Groups;
foreach (IdentityReference ir in irc)
{
NTAccount acc = (NTAccount)ir.Translate(typeof(NTAccount));
groups.Add(acc.Value);
}
return groups;
}
-----------------------------------------------------------------------------------
protected void LookupADBtn_Click(object sender, EventArgs e)
{
string username = aduser.Text;
Response.Write("You are logged in as " + username + " your GROUPS are: ");
//WindowsIdentity id = (WindowsIdentity)HttpContext.Current.User.Identity;
WindowsIdentity id = new WindowsIdentity(username);
foreach (string roles in getGroupsforUser(id))
{
Label1.Text += "<br>" + roles.ToString();
}
}