PrepAway - Latest Free Exam Questions & Answers

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?

PrepAway - Latest Free Exam Questions & Answers

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


Leave a Reply