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?
You are creating an ASP.NET Web site. The site has a master page named Custom.master. The code-behind file for Custom.master contains the following code segment. public partial class CustomMaster : MasterPage {
public string Region
{
get; set;
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
You create a new ASP.NET page and specify Custom.master as its master page.
You add a Label control named lblRegion to the new page.
You need to display the value of the master page's Region property in lblRegion.
What should you do?
You are implementing an ASP.NET Web site. The site allows users to explicitly choose the display language for the site's Web pages. You create a Web page that contains a DropDownList named ddlLanguage, as shown in
the following code segment. AutoPostBack="True" ClientIDMode="Static"
OnSelectedIndexChanged="SelectedLanguageChanged"> English Spanish French German
The site contains localized resources for all page content that must be translated into the language that is selected by the user.
You need to add code to ensure that the page displays content in the selected language if the user selects a language in the drop-down list.
Which code segment should you use?
You are implementing a method in an ASP.NET application that includes the following requirements. Store the number of active bugs in the cache. The value should remain in the cache when there are calls more often than
every 15 seconds. The value should be removed from the cache after 60 seconds. You need to add code to meet the requirements. Which code segment should you add?
You create a Web page named TestPage.aspx and a user control named contained in a file named
TestUserControl.ascx.
You need to dynamically add TestUserControl.ascx to TestPage.aspx.
Which code segment should you use?
You are implementing custom ASP.NET server controls.
You have a base class named RotaryGaugeControl and two subclasses named CompassGaugeControl and SpeedGaugeControl.
Each control requires its own client JavaScript code in order to function properly. The JavaScript includes
functions that are used to create the proper HTML elements for the control. You need to ensure that the
JavaScript for each of these controls that is used in an ASP.NET page is included in the generated HTML page only once, even if the ASP.NET page uses multiple instances of the given control.
What should you do?
You are creating an ASP.NET Web site. You create a HTTP module named CustomModule, and you register the module in the web.config file.
The CustomModule class contains the following code.
public class CustomModule : IHttpModule
{
string footerContent = "
Footer Content
";
public void Dispose() {}
}
You need to add code to CustomModule to append the footer content to each processed ASP.NET page.
Which code segment should you use?
You are implementing an ASP.NET Web site. The root directory of the site contains a page named Error.aspx.
You need to display the Error.aspx page if an unhandled error occurs on any page within the site. You also must ensure that the original URL in the browser is not changed.
What should you do?
You use the ASP.NET Web Site template to create a Web site that will be deployed to multiple locations. Each location will specify its SMTP configuration settings in a separate file named smtp.config in the root folder of
the Web site.
You need to ensure that the configuration settings that are specified in the smtp.config file will be applied to the Web site.
Which configuration should you use in web.config?
You deploy an ASP.NET application to an IIS server.
You need to log health-monitoring events with severity level of error to the Windows application event log.
What should you do?