I am preparing for the Microsoft Certificate exam (70-515), reading the Microsoft book for this exam, practicing the tests ... one test asks:
You create a custom MVC action filter to cache action results.
Which virtual method should be overridden?
The correct answer (according to the test program that is distributed with the book) is "OnResultExecuting"
And an explanation of the answer:
When creating a custom action filter by inheriting the ActionFilterAttribute class, you can override four virtual methods that execute in the following order: OnActionExecuting (), OnActionExecuted (), OnResultExecuting (), and OnResultExecuted (). For output caching, you want final results. Therefore, you must override the last method to run: OnResultExecuting ().
Here's the inconsistency: if we need to override the LAST method, then it must be "OnResultExecuted". But the answer says "OnResultExecuting".
So the question is:
- What is the CORRECT method for overriding?
- Which option to choose on the exam to get an answer that is considered correct? (The question is correct for the case when the "correct" answer is really different from the one proposed by the system.
Thanks.
PS I'm not sure the current question belongs to SO, but at least it's pretty close.
Budda
source share