PrepAway - Latest Free Exam Questions & Answers

You need to ensure that the About action is invokedwhen 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.cs file. (Line numbers are included for reference
only.)
01 public static void RegisterRoutes(RouteCollection routes)
02 {
03 routes.IgnoreRoute(“{resource}.axd/{*pathInfo}”);
05 routes.MapRoute(“Default”, “{controller}/{action}/{id}”, new {controller =
“Home”, action = “Index”, id = “”});
06 }
You implement a controller named HomeController that includes methods with the following signatures.
public ActionResult About()
public ActionResult Index()
public ActionResult Details(int id)
You need to ensure that the About action is invokedwhen 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.cs file, add the following line of code.
routes.MapRoute(“Default4Empty”, “/”, new {controller = “Home”, action =
“About”});

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

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

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


Leave a Reply