Question:You are creating an ASP.NET Web site. The site is configured to use Membership and Role management providers. You need to check whether the currently logged-on user is a member of a role named Administrators. Which code segment should you use?
A bool isMember = Roles.GetUsersInRole("Administrators").Any();
B bool isMember = Membership.ValidateUser(User.Identity.Name, "Administrators");
C bool isMember = Roles.GetRolesForUser("Administrators").Any();
D bool isMember = User.IsInRole("Administrators");
+ AnswerD
+ Report