Microsoft Exam Questions

Which code segments should you include in Target 1 and …

DRAG DROP
You need to ensure that URLs for log manipulation are mapped to the controller.
You have the following code:

Which code segments should you include in Target 1 and Target 2 to map the URLs? To answer, drag the
appropriate code segments to the correct targets. Each code segment may be used once, more than once, or
not at all. You need to drag the split bar between panes or scroll to view content.
Select and Place:

Answer:

Explanation:
Target 1: routes.MapRoute(
The MapRoute method takes three parameters: routes, name, and URL.
Target 2: url: “GetLog/{action}/{id}”,
Example code:
routes.MapRoute(
“Default”, // Route name
“{controller}/{action}/{id}”, // URL with parameters
new { controller =”Home”, action = “Index”, id = “” } // Parameter defaults);
Incorrect:
Not routes.MapHttpRoute(:
The MapHttpRoute method takes three parameters: routes, name, and routetemplate, but we need an URL
parameter, not a routeTemplate parameter.

https://msdn.microsoft.com/en-us/library/system.web.mvc.routecollectionextensions.maproute(v=vs.118).aspx
https://msdn.microsoft.com/en-us/library/cc668201.aspx