找考题网-背景图
单项选择题

A.Add the following directive to TestPage.aspx. <%@ Mas……

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 void Page_Load(object sender, EventArgs e) { string s = Master.CityName; }  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" %><%@ mastertype="" virtualpath="~/TestMaster.master">
B.Add the following directive to TestPage.aspx. <%@ PreviousPageType VirtualPath="~/TestMaster.master" %><%@ 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.

热门试题

单项选择题YoucreateanewASP.NETMVC2Webapplication.ThefollowingdefaultroutesarecreatedintheGlobal.asax.vbfile.01SharedSubRegisterRoutes(ByValroutesAsRouteCollection)0203routes.IgnoreRoute( {resource}.axd {*pathInfo} )0405routes.MapRoute( Default , {controller} {action} {id} ,NewWith{.controller= Home ,.action= Index ,.id= })06EndSubYouimplementacontrollernamedHomeControllerthatincludesmethodswiththefollowingsignatures.FunctionIndex()AsActionResultFunctionDetails(ByValidAsInteger)AsActionResultFunctionDetailsByUsername(ByValusernameAsString)AsActionResultYouneedtoaddaroutetomeetthefollowingrequirements.ThedetailsforausermustbedisplayedwhenausernameisenteredasthepathbyinvokingtheDetailsByUsernameaction.Usernamescancontainalphanumericcharactersandunderscores,andcanbebetween3and20characterslong.Whatshouldyoudo?()

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}"} )

单项选择题YouareimplementinganASP.NETMVC2application.IntheAreasfolder,youaddasubfoldernamedProducttocreateasingleprojectareA.YouaddfilesnamedProductController.vbandIndex.aspxtotheappropriatesubfolders.YouthenaddafilenamedRoute.vbtotheProductfolderthatcontainsthefollowingcode.01PublicClassRouteInheritsAreaRegistration0203PublicOverridesReadOnlyPropertyAreaNameAsString04Get05Return product 06EndGet07EndProperty0809PublicOverridesSubRegisterArea(ByValcontextAsAreaRegistrationContext)1011context.MapRoute( product_default , product {controller} {action} {id} ,NewWith{.controller= Product ,.action= Index ,.id= })1213EndSubEndClassWhenyouloadtheURLhttp: product,youdiscoverthatthecorrectpageisnotreturned.Youneedtoensurethatthecorrectpageisreturned.Whatshouldyoudo?()

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