You need to ensure that the correct page is returned

You are implementing an ASP.NET MVC 2 application. In the Areas folder, you add a subfolder
named Product to create a single project area. You add files named ProductController.vb and
Index.aspx to the appropriate subfolders. You then add a file named Route.vb to the Product folder
that contains the following code. (Line numbers are included for reference only.)
01 Public Class Route
Inherits AreaRegistration
02
03 Public Overrides ReadOnly Property AreaName As String
04 Get
05 Return “product”
06 End Get
07 End Property
08
09 Public Overrides Sub RegisterArea(
ByVal context As AreaRegistrationContext)
10
11 context.MapRoute(“product_default”,
“product/{controller}/{action}/{id}”,
New With {.controller = “Product”, .action = “Index”,
.id = “”})
12
13 End Sub
End Class
When you load the URL http://<applicationname>/product, you discover that the correct page is not
returned. You need to ensure that the correct page is returned. What should you do?

You are implementing an ASP.NET MVC 2 application. In the Areas folder, you add a subfolder
named Product to create a single project area. You add files named ProductController.vb and
Index.aspx to the appropriate subfolders. You then add a file named Route.vb to the Product folder
that contains the following code. (Line numbers are included for reference only.)
01 Public Class Route
Inherits AreaRegistration
02
03 Public Overrides ReadOnly Property AreaName As String
04 Get
05 Return “product”
06 End Get
07 End Property
08
09 Public Overrides Sub RegisterArea(
ByVal context As AreaRegistrationContext)
10
11 context.MapRoute(“product_default”,
“product/{controller}/{action}/{id}”,
New With {.controller = “Product”, .action = “Index”,
.id = “”})
12
13 End Sub
End Class
When you load the URL http://<applicationname>/product, you discover that the correct page is not
returned. You need to ensure that the correct page is returned. What should you do?

A.
Replace line 11 with the following code segment.
context.MapRoute(“product_default”,
“{area}/{controller}/{action}/{id}”,
New With {.area = “product”, .controller = “Product”,
.action = “Index”, .id = “”})

B.
Replace line 11 with the following code segment.
context.MapRoute(“product_default”,
“{area}”,
New With {.controller = “Product”, .action = “Index”, .id = “”})

C.
Add the following code segment at line 12.
AreaRegistration.RegisterAllAreas()

D.
Add the following code segment to the RegisterRoutes method in the Global.asax.vb file.
AreaRegistration.RegisterAllAreas()



Leave a Reply 0

Your email address will not be published. Required fields are marked *