PrepAway - Latest Free Exam Questions & Answers

Category: 70-552

Exam 70-552: UPGRADE: MCAD Skills to MCPD Windows Developer by Using the Microsoft .NET Framework

Which code segment should you use?

You are developing an application that runs by using the credentials of the end user. Only users who are members of the Administrator group get permission to run the application. You write the following security code to protect sensitive data within the application.

bool isAdmin = false;
WindowsBuiltInRole role = WindowsBuiltInRole.Administrator; …
if (!isAdmin)
throw new Exception(“User not permitted”);

You need to add a code segment to this security code to ensure that the application throws an exception if a user is not a member of the Administrator group.
Which code segment should you use?

Which code segment should you use?

You are writing code for user authentication and authorization. The username, password, and roles are stored in your application data store. You need to establish a user security context that will be used for authorization checks such as IsInRole. You write the following code segment to authorize the user.

if (!TestPassword(userName, password))
throw new Exception(“could not authenticate user”);
String[] userRolesArray = LookupUserRoles(userName);

You need to complete this code so that it establishes the user security context.
Which code segment should you use?


Page 12 of 12« First...89101112