单项选择题You are developing an ASP.NET Web page that contains input controls, validation controls, and a button named btnSubmit.  The page has the following code-behind.01 Public Class _Default  02 Inherits System.Web.UI.Page03   04 Protected Sub SaveToDatabase()05   06 End Sub07   08 Protected Sub btnSubmit_Click(ByVal sender As Object,09 ByVal e As EventArgs) Handles btnSubmit.Click10   11 End Sub12   13 End Class  You need to ensure that all data that is submitted passes validation before the data is saved in a database. What should you do? ()

A.Add the following method override. Protected Overrides Sub OnInit(ByVal e As EventArgs)  MyBase.OnInit(e) If (Page.IsValid) Then Me.SaveToDatabase() End Sub
B.Add the following method override. Protected Overrides Sub OnLoad(ByVal e As EventArgs)  MyBase.OnLoad(e) If (Page.IsValid) Then Me.SaveToDatabase() End Sub
C.Add the following method override.Protected Overrides Sub OnPreRender(ByVal e As EventArgs)  MyBase.OnPreRender(e) If (Page.IsValid) Then Me.SaveToDatabase() End Sub
D.Add the following code segment at line 10. If (Page.IsValid) Then Me.SaveToDatabase()


您可能感兴趣的试卷

你可能感兴趣的试题

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

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

3.单项选择题

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

4.多项选择题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.

5.多项选择题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

10.单项选择题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. 

最新试题

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 debugging an ASP.NET Web application by using the Visual Studio debugger. The application is incorrectly handling a SQL Exception on the login page. You need to break execution where the exception is thrown . What should you do?()

题型:单项选择题

Which class defines the contract that ASP.NET implements to provide membership services using custom membership providers?()

题型:单项选择题

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

题型:单项选择题

You need to ensure that when the button is clicked, both update panels update the tim without generating a postback.  What should you do?()

题型:单项选择题

You have migrated a web application from .net 3.5 to 4.0. the application hat to render same as in .net 3.5.()

题型:单项选择题

You work as an ASP.NET Web Application Developer for SomeCompany. The company uses Visual Studio .NET 2010 as its application development platform. You have recently finished the development of an ASP.NET Web application using .NET Framework 4.0. Now, you are deploying the ASP.NET Web application to a remote server. You are required to select a deployment method that will make sure that all Internet Information Services (IIS) settings, in addition to the Web content, are deployed to the remote server. Which of the following deployment methods will you select 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?()

题型:单项选择题

Which method of the Page class searches the page naming container for a server control with a particular identifer?()

题型:单项选择题

A library called contosobuisness.dll has been created and u need to accept it in a page.. all options had the <%assembly tag but the att differed.()

题型:单项选择题