Which code segments should you include in Target 1, Target 2 and Target 3 to implement the LogActionFilter class?

HOTSPOT

You are developing an ASP.NET MVC application.

Before an action is executed, information about the action must be written to a log. After results are returned, information about the results also must be written to the log.

You need to log the actions and results.

You have the following code:

Which code segments should you include in Target 1, Target 2 and Target 3 to implement the LogActionFilter class? (To answer, select the appropriate option from the drop-down list in the answer area.)

Answer:

Explanation:

Target 1: IActionFilter

MVC3 introduced a completely new pattern to configure filters for controllers and its actions. While injection of filter attributes is still supported it is recommended using this new pattern for filter configuration because it has the advantage to support constructor injection and does not require the InjectAttribute anymore.

First of all you have to create your filter class by implementing one of the filter interfaces e.g. IActionFilter.

Target 2: public void OnActionExecuting(ActionExecutingContext filterContext)

Target 3: public void OnActionExecuted(ActionExecutedContext filterContext)

References:

Latest 70-486 Dumps Valid Version with 255 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments