exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 4 question 1 discussion

Actual exam question from Microsoft's 70-486
Question #: 1
Topic #: 4
[All 70-486 Questions]

You need to ensure that all the MVC controllers are secure.
Which code segment should you use as the body for the CreateController method in AdminVerifierFactory.cs?

  • A. Option A
  • B. Option B
  • C. Option C
  • D. Option D
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
The MemberInfo.CustomAttributes property gets a collection that contains this member's custom attributes.
The Any() statement will either return null or a collection of matched custom attributes. If it matches one or more, the controller is secure, otherwise an exception is thrown.
From scenario: The application contains a header that is visible on every page.
If the logged-on user is an administrator, then the header will contain links to administrative functions. This information is read from a cookie that is set on the server. The administrative links must not be present if an error condition is present.
Incorrect:
Not A: controller.GetType().Attributes will not return custom attributes.
References:
https://msdn.microsoft.com/en-us/library/system.reflection.memberinfo.customattributes(v=vs.110).aspx

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
elathir
4 years, 9 months ago
All answers are incorrect. There is probably a typo in answer 3, it either should have false check instead of null, or where instead of any. This two alterations will make it correct.
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...