单项选择题
You are implementing an ASP.NET Web site. The site uses a component that must be dynamically configured before it can be used within site pages. You create a static method named SiteHelper.Configure that configures the component. You need to add a code segment to the Global.asax file that invokes the SiteHelper.Configure method the first time, and only the first time, that any page in the site is requested. Which code segment should you use? ()
A.void Application_Start(object sender, EventArgs e) { SiteHelper.Configure(); }
B.void Application_Init(object sender, EventArgs e) { SiteHelper.Configure(); }
C.void Application_BeginRequest(object sender, EventArgs e) { SiteHelper.Configure(); }
D.Object lockObject = new Object(); void Application_BeginRequest(object sender, EventArgs e) { lock(lockObject()) { SiteHelper.Configure(); } }
相关考题
-
单项选择题
YouareimplementinganASP.NETWebsite.TherootdirectoryofthesitecontainsapagenamedError.aspx.YouneedtodisplaytheError.aspxpageifanunhandlederroroccursonanypagewithinthesite.YoualsomustensurethattheoriginalURLinthebrowserisnotchanged.Whatshouldyoudo?()
A.Add the following configuration to the web.config file.
B.Add the following configuration to the web.config file.
C.Add the following code segment to the Global.asax file.
D.Add the following code segment to the Global.asax file. -
单项选择题
YouarecreatinganASP.NETWebsite.ThesiteisconfiguredtouseMembershipandRolemanagementproviders.Youneedtocheckwhetherthecurrentlylogged-onuserisamemberofarolenamedAdministrators.Whichcodesegmentshouldyouuse?()
A.bool isMember = Roles.GetUsersInRole("Administrators").Any()
B.bool isMember = Membership.ValidateUser(User.Identity.Name, "Administrators")
C.bool isMember = Roles.GetRolesForUser("Administrators").Any()
D.bool isMember = User.IsInRole("Administrators") -
多项选择题
YoucreateanASP.NETpagethatcontainsthefollowingtag.PageNameYouneedtowritecodethatwillchangethecontentsofthetagdynamicallywhenthepageisloaded.Whataretwopossiblewaystoachievethisgoal?()
A.this.hdr1.InnerHtml = "Text";
B.(hdr1.Parent as HtmlGenericControl).InnerText = "Text";
C.HtmlGenericControl h1 = this.FindControl("hdr1") as HtmlGenericControl;h1.InnerText = "Text";
D.HtmlGenericControl h1 = Parent.FindControl("hdr1") as HtmlGenericControl;h1.InnerText = "Text";
