70-515 · Question #203
You are developing an ASP.NET MVC 2 Web application that displays product details. The global.asax.cs file contains the following code segment 01 public static void registerRoutes(RouteCollection…
The correct answer is D. Add the following code segment between lines 03 and 04. routes. ASP.NET MVC checks incoming URL requests against routes in the order they were registered, so you need to add them in the order of most to least specific.
Question
You are developing an ASP.NET MVC 2 Web application that displays product details. The global.asax.cs file contains the following code segment 01 public static void registerRoutes(RouteCollection routes) 02 { 03 routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 04 routes.MapRoute("Default", "{controller}/{action}/{id}", new {controller = "Home", action = "index", id = UrlParameter.Optional}); 05 } The URL "/products/PRODUCTNAME", where PRODUCTNAME is the name of the product, must give details for the product that is stored in a Microsoft SQL Server database. You need to ensure that the routes are registered correctly. What should you do?
Options
- AReplace line 04 with the following code segment routes.
- BAdd the following code segment between lines 04 and 05 routes.
- CReplace lines 03 and 04 with the following code segment routes.
- DAdd the following code segment between lines 03 and 04. routes.
How the community answered
(28 responses)- A14% (4)
- B4% (1)
- C4% (1)
- D79% (22)
Explanation
ASP.NET MVC checks incoming URL requests against routes in the order they were registered, so you need to add them in the order of most to least specific.
Topics
Community Discussion
No community discussion yet for this question.