I'm using C# in VS2010 and I need some help with a web application. I don't have much experience with web services. I was given the url to a webservice containing methods required to build the login part of the application. No documentation. I have the login piece working though. Then I get stuck. Upon successful login I need to call another method which returns a list (or object?) of Roles that the authenticated user has access to. The items it returns for myself for example are (name, nameField) and a total of 20 roles. I just want to see if 1 role exists out of the 20.
protected void Button_Click(object sender, EventArgs e)
{
ServiceReference1.Identity usr = new ServiceReference1.Identity();
loginService.AuthenticationService auth = new loginService.AuthenticationService();
loginService.AuthenticationService auth = new loginService.AuthenticationService();
auth.Login(TextBox1.Text, TextBox2.Text, "10.55.31.91");
List<object> roles = new List<object>(auth.GetIdentityRoles(TextBox1.Text));
IEnumerable myEnum = roles;
IEnumerator myEnumerator = myEnum.GetEnumerator(); //Getting the Enumerator
myEnumerator.Reset(); //Position at the Beginning
while (myEnumerator.MoveNext()) //Till not finished do print
{
Response.Write(myEnumerator.Current.ToString());
}
}
Now, if I hover over "roles" in line 6 while debugging I can see the field I want to search. I want to know if "Name" contains "Administrator" but all my examples only return "loginService.Role" in line 13. It just writes loginService.Roles 20 times. I need to get down to the next level. It's Friday and it's my Birthday, please help me out lol.
[+] roles = Count = 20
[+] {loginService.Role}
Name = "Administrator"
nameField = "Administrator"