You create a new ASP.NET MVC 2 Web application. The following default routes are created in the Global.asax.vb file.01 Shared Sub RegisterRoutes(ByVal routes As RouteCollection)02 03 routes.IgnoreRoute("{resource}.axd/{*pathInfo}")04 05 routes.MapRoute( "Default", "{controller}/{action}/{id}", New With {.controller = "Home", .action = "Index", .id = ""}) 06 End Sub You implement a controller named HomeController that includes methods with the following signatures.Function Index() As ActionResult Function Details(ByVal id As Integer) As ActionResultFunction DetailsByUsername( ByVal username As String) As ActionResult You need to add a route to meet the following requirements. The details for a user must be displayed when a user name is entered as the path by invoking the DetailsByUsername action. User names can contain alphanumeric characters and underscores, and can be between 3 and 20 characters long.What should you do?()
- A、Replace line 05 with the following code segment. routes.MapRoute( "Default", "{controller}/{action}/{id}", New With {.controller = "Home", .action = "DetailsByUsername", .id = ""})
- B、Replace line 05 with the following code segment. routes.MapRoute("Default", "{controller}/{action}/{username}", New With {.controller = "Home", .action = "DetailsByUsername", .username = ""}, New With {.username = "/w{3,20}"} )
- C、At line 04, add the following code segment.routes.MapRoute( "Details byUsername""{username}", New With {.controller = "Home", .action = "DetailsByUsername"}, New With {.username = "/w{3,20}"})
- D、At line 04, add the following code segment. routes.MapRoute( "Details by Username", "{id}", New With {.controller = "Home", .action = "DetailsByUsername"}, New With {.id = "/w{3,20}"} )
微信扫一扫手机做题