PrepAway - Latest Free Exam Questions & Answers

You need to ensure that the About action is invoked when the root URL of the site is accessed

You create a new ASP.NET MVC 2 Web application. The following default routes are created in the
Global.
asax.vb file. (Line numbers are included for reference only.) 01 Shared Sub RegisterRoutes(ByVal
routes As
RouteCollection) 03 routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”)
05 routes.MapRoute(_
“Default”,
“{controller}/{action}/{id}”,
New With {.controller = “Home”, .action = “Index”, .id = “”} )
07 End Sub
You implement a controller named HomeController that includes methods with the following
signatures.
Function About() As ActionResult
Function Index() As ActionResult
Function Details(ByVal id As Integer) As ActionResult
You need to ensure that the About action is invoked when the root URL of the site is accessed. What
should you do?

PrepAway - Latest Free Exam Questions & Answers

A.
At line 04 in the Global.asax.vb file, add the following line of code.
routes.MapRoute(“Default4Empty”, “/”,
New With {.controller = “Home”, .action = “About”})

B.
At line 04 in the Global.asax.vb file, add the following line of code.
routes.MapRoute(“Default”, “”,
New With {.controller = “Home”, .action = “About”})

C.
Replace line 05 in the Global.asax.vb file with the following line of code.
routes.MapRoute(“Default4Empty”,”{controller}/{action}/{id}”,
New With {.controller = “Home”, .action = “About”, .id = “”} )

D.
Replace line 05 in the Global.asax.vb file with the following line of code.
routes.MapRoute(“Default”,
“{controller}/{action}”,New With {.controller = “Home”, .action = “About”} )


Leave a Reply