Which code segment should you use?

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");

microsoft-exams

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.