单项选择题
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.01 Public Class Route Inherits AreaRegistration02 03 Public Overrides ReadOnly Property AreaName As String04 Get 05 Return "product"06 End Get 07 End Property08 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:///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()
相关考题
-
单项选择题
You are creating an ASP.NET Web site. You create a HTTP module named Custom Module, and you register the module in the web.config file.The Custom Module class contains the following code. Public Class Custom Module Implements IHttpModule Dim footerContent As String = Footer Content"Public Sub Dispose() Implements IHttpModule.DisposeEnd SubEnd Class You need to add code to CustomModule to append the footer content to each processed ASP.NET page. Which code segment should you use?()
A.Public Sub New(ByVal app As HttpApplication) AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = TryCast(sender, HttpApplication) app.Response.Write(footerContent) End Sub
B.Public Sub Init(ByVal app As HttpApplication) _ Implements IHttpModule.Init AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = New HttpApplication() app.Response.Write(footerContent) End Sub
C.Public Sub New() Dim app As HttpApplication = New HttpApplication() AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = TryCast(sender, HttpApplication) app.Response.Write(footerContent) End Sub
D.Public Sub Init(ByVal app As HttpApplication) _ Implements IHttpModule.Init AddHandler app.EndRequest, AddressOf app_EndRequest End Sub Sub app_EndRequest(ByVal sender As Object, ByVal e As EventArgs) Dim app As HttpApplication = TryCast(sender, HttpApplication)app.Response.Write(footerContent) End Sub -
多项选择题
YouareimplementinganASP.NETWebapplication.UserswillauthenticatetotheapplicationwithanID.Theapplicationwillallownewuserstoregisterforanaccount.TheapplicationwillgenerateanIDfortheuserbasedontheusersfullname.Youneedtoimplementthisregistrationfunctionality.Whichtwoactionsshouldyouperform?()
A.Configure the SqlMembershipProvider in the web.config file.
B.Configure the SqlProfileProvider in the web.config file.
C.Create an ASP.NET page that contains a default CreateUserWizard control to create a new user account.
D.Create an ASP.NET page that contains a custom form that collects the user information and then uses the Membership.CreateUser method to create a new user account. -
多项选择题
YouareimplementinganASP.NETMVC2Webapplication.YouaddacontrollernamedCompany Controller.YouneedtomodifytheapplicationtohandletheURLpath/company/info.Whichtwoactionsshouldyouperform?()
A.Add the following method to the CompanyController class. Function Info() As ActionResult Return View() End Function
B.Add the following method to the CompanyController class. Function Company_Info() As ActionResult Return View() End Function
C.Right-click the Views folder, and select View from the Add submenu to create the view for the action.
D.Right-click inside the action method in the CompanyController class, and select Add View to create a view for the action
