单项选择题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}"} )


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题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()

2.单项选择题

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

3.多项选择题You are implementing an ASP.NET Web application. Users will authenticate to the application with an ID. The application will allow new users to register for an account. The application will generate an ID for the user based on the users full name. You need to implement this registration functionality. Which two actions should you perform?()

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.

4.多项选择题You are implementing an ASP. NET MVC 2 Web application. You add a controller named Company Controller. You need to modify the application to handle the URL path /company/info. Which two actions should you perform?()

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

9.单项选择题You are implementing an ASP.NET application that includes a page named TestPage.aspx. TestPage.aspx uses a master page named TestMaster.master.You add the following code to the TestPage.aspx code-behind file to read a TestMaster.master public property named CityName. Protected Sub Page_Load(ByVal sender As Object,ByVal e As System.EventArgs) Handles Me.LoadDim s As String = Master.CityNameEnd Sub  You need to ensure that TestPage.aspx can access the CityName property. What should you do?()

A.Add the following directive to TestPage.aspx. <%@ MasterType VirtualPath="~/TestMaster.master" %> 
B.Add the following directive to TestPage.aspx. <%@ PreviousPageType VirtualPath="~/TestMaster.master" %> 
C.Set the Strict attribute in the @ Master directive of the TestMaster.master page to true. 
D.Set the Explicit attribute in the @ Master directive of the TestMaster.master page to true. 

10.单项选择题You are troubleshooting an ASP.NET Web application. System administrators have recently expanded your web farm from one to two servers. Users are periodically reporting an error message about invalid view state. You need to fix the problem. What should you do?()

A.Set viewStateEncryptionMode to Auto in web.config on both servers.
B.Set the machineKey in machine.config to the same value on both servers.
C.Change the session state mode to SQLServer on both servers and ensure both servers use the same connection string.
D.Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.

最新试题

You create an ASP.NET server control in the SampleControl namespace. The control uses a JavaScript file names Refresh.js to implement AJAX functionality.You need to ensre that the JavaScript file is included in the assembly. Which two actions should you perform?()

题型:多项选择题

You work as an ASP.NET Web Application Developer for SomeCompany.  The company uses Visual Studio .NET 2010 as its application development platform. You create an ASP.NET Web application using .NET Framework 4.0. You create a Web page in the application. The Web page will get large sets of data from a data source.  You add a DataPager control to the page. You are required to display navigation controls that enable you to create a custom paging Ul for the DataPager control. What will you do?()

题型:单项选择题

Which of the following is the correct collection of build events?()

题型:单项选择题

You work as an ASP.NET Web Application Developer for SomeCompany. The company uses Visual Studio .NET 2010 as its application development platform.  You create an ASP.NET Web application using .NET Framework 4.0. The ASP.NET application is used to track employee performance. It uses Microsoft Windows authentication. Employees are members of a group named Employees.  Managers are members of a group named Managers.  The root folder of the application is named Details. The Details folder displays information about employees„ performance.  The Details folder has a subfolder named MoreDetails. You need to ensure that employees and managers can access pages stored in the Details folder. However, only managers can access pages stored in the MoreDetails folder.   You make the following entries in the Web.config file in the Details folder.You make the following entries in the Web.config file in the MoreDetails folder.When managers try to access pages stored in the MoreDetails folder, they receive the following error message:"An error occurred during the processing of a configuration file required to service this request." You must ensure that managers are able to access pages stored in the MoreDetails folder. What will you do to accomplish this?()

题型:单项选择题

You are developing an ASP.NET MVC 2 Web Application. You need to implement an asynchronous controller named AccountingController, and you must ensure that the export action required proper authorization.Which code segment should you use?()

题型:单项选择题

You have a master page custom.master ... u create a nested.master page using it ... and then u have content page that uses the nested.master as its master page ...  to get a string prop from custom.master into a label in content page the code u wud use()

题型:单项选择题

The page will be posted to the server after one or more image files are selected for upload.You need to ensure that all unuploaded files are saved to the server within one call to a single event handler. What should you do? ()

题型:单项选择题

Which control allows you to bind to data items that are returned from a data source and display them?()

题型:单项选择题

You are developing an ASP.NET Web application.The application is configured to use the membership and role providers. You need to allow all users to perform an HTTP GET for application resources, but you must allow only the user named Moderator to perform a POST operation.Which configuration should you add to the web.config file?()

题型:单项选择题

You are perfoming security testing on an existing asp.net web page.You notice that you are able to issue unauthorised postback requests to the page. You need to prevent unauthorised post back requests. which page directive you use?()

题型:单项选择题