Which code segment should you use?
You need to write a code segment that will add a string named strConn to the connection string section of the application configuration file. Which code segment should you use?
Which code segment should you use?
You are developing a server application that will transmit sensitive information on a network. You create an X509Certificate object named certificate and a TcpClient object named client. You need to create an SslStream to communicate by using the Transport Layer Security 1.0 protocol. Which code segment should you use?
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 permission class should you use?
You are creating an assembly named Assembly1. Assembly1 contains a public method. The global cache contains a second assembly named Assembly2. You must ensure that the public method is only called from Assembly2. Which permission class should you use?
Which code segment should you use?
You are developing a method to hash data for later verification by using the MD5 algorithm. The data is passed to your method as a byte array named message. You need to compute the hash of the incoming parameter by using MD5. You also need to place the result into a byte array.
Which code segment should you use?
Which code segment should you use?
You are developing an application that will deploy by using ClickOnce. You need to test if the application executes properly. You need to write a method that returns the object, which prompts the user to install a ClickOnce application. 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?
Which code segment should you use?
You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?
Which method should you use on the DirectorySecurity object?
You create a DirectorySecurity object for the working directory. You need to identify the user accounts and groups that have read and write permissions. Which method should you use on the DirectorySecurity object?
Which code segment should you use?
You are developing an application that will use custom authentication and role-based security. You need to write a code segment to make the runtime assign an unauthenticated principal object to each running thread. Which code segment should you use?