Question 103


3.4.2 Question

Multiple Choice

You are developing an ASP.NET MVC application. You noticed a bug on the DVD controller of the application. You want to ignore the DVD pages until the bug is fixed. What should you do?

  • A. Add route.SetItem(route.Count, “dvd/”); to the RegisterRoute method.
  • B. Add route.IgnoreRoute(“dvd/”); to the RegisterRoute method.
  • C. Add route.Insert(route.Count,“dvd/”); to the RegisterRoute method.
  • D. Add route.Remove(“dvd/”); to the RegisterRoute method.

Answer:

B
Explanation
A. Incorrect: SetItem adds an item to the collection. However, adding a route at the end of the collection does not solve the problem because it is being added as a route that should be matched.
B. Correct: IgnoreRoute is the correct statement to use.
C. Incorrect: Insert adds a new route to the collection for matching, but does not ignore pages.
D. Incorrect: Remove removes a route from the table. More than likely, this is an implied mapping, so removing the DVD route does not stop the application from mapping the request to the same action.