Exam 70-562 : Microsoft .NET Framework 3.5, ASP.NET Application Development – 23

Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. An exception management framework is not used in the Web application. You need to ensure that the application log the unhandled exceptions automatically to the event log. You need to configure the Web.config file to accomplish this. Identify the configuration that will assist you in this scenario?

  1. You should consider using the <healthMonitoring enabled=”true”/> configuration.
  2. You should consider using the <deployment retail=”true”/> configuration.
  3. You should consider using the <customErrors mode=”On”/> configuration.
  4. You should consider using the <trace enabled=”true”/> configuration.

Correct Answer: 1


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web site using Microsoft ASP.NET 3.5. The following code is present in the Global.asax file:

void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
Exception ex = exception;
if (exception is HttpUnhandledException)
{
ex = exception.InnerException;
}
UnhandledExceptionWebErrorEvent evt = new UnhandledExceptionWebErrorEvent(ex);
evt.Raise();
} 

As soon as the code is implemented you need to send an e-mail to development@Company.com with the details of the exception. The UnhandledExceptionWebErrorEvent class exists in the App_Code folder. It is part of the Company.WebEvents namespace. The root Web.config file is not changed from its default configuration. You have to configure health monitoring in the Web.config file of the application. Identify the configuration that will accomplish this?

  1. You should use:
    <healthMonitoring enabled=”true”>
    <eventMappings>
    <add name=”UnhandledExceptionWebErrorEvent” type=”WebErrorEvent”/>
    </eventMappings>
    <rules>
    <add name=”Email Unhandled Exceptions” eventName=”UnhandledExceptionWebErrorEvent” provider=”SimpleMailProvider” profile=”Default” custom=”mailto:dev@Company.com”/>
    </rules>
    </healthMonitoring>
  2. You should use:
    <healthMonitoring enabled=”true”>
    <eventMappings>
    <add name=”Unhandled Exceptions” type=”Company.WebEvents.UnhandledExceptionWebErrorEvent, App_Code”/>
    </eventMappings>
    <rules>
    <add name=”Email Unhandled Exceptions” eventName=”Unhandled Exceptions” provider=”SimpleMailProvider” profile=”Critical” custom=”mailto:dev@Company.com”/>
    </rules>
    </healthMonitoring>
  3. You should use:
    <healthMonitoring enabled=”true”>
    <eventMappings>
    <add name=”Unhandled Exceptions” type=”Company.WebEvents.UnhandledExceptionWebErrorEvent, App_Code”/>
    </eventMappings>
    <providers>
    <add name=”SimpleMailProvider” type=”System.Web.Management.SimpleMailWebEventProvider, System.Web,Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” from=”app@Company.com” to=”dev@Company.com” bufferMode=”Critical Notification”/>
    </providers>
    <rules>
    <add name=”Email Unhandled Exceptions” eventName=”Unhandled Exceptions” provider=”SimpleMailProvider” profile=”Critical”/>
    </rules>
    </healthMonitoring>
  4. You should use:
    <healthMonitoring enabled=”true”>
    <eventMappings>
    <add name=” WebErrorEvent” type=” UnhandledExceptionWebErrorEvent”/>
    </eventMappings>
    <rules>
    <add name=”Email Unhandled Exceptions” eventName=”WebErrorEvent” provider=”SimpleMailProvider” profile=”Default” custom=”mailto:dev@Company.com”/>
    </rules>
    </healthMonitoring>

Correct Answer: 3


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. You notice the following code that exist in the code-behind file for a page named products.aspx:

[WebMethod]
public static string GetSessionObject(string key)
{
return HttpContext.Current.Session[key] as string;
} 

You decide to call the GetSessionObject method from JavaScript. You then pass it to the value of a TextBox control named _sessionKey. You need to ensure that the return value is displayed in a browser alert window. You need to make the necessary changes to the page to accomplish this. What should you do? (Choose all that apply)

  1. You should add the following script block to the page:
    <script language=”javascript” type=”text/javascript”>
    function GetSessionObject()
    {
    var sessionKey = $get(‘_sessionKey’).value;
    var result = Admin.GetSessionObject(sessionKey);
    window.alert(result);
    }
    </script>
  2. You should add the following script block to the page:
    <script language=”javascript” type=”text/javascript”>
    function GetSessionObject()
    {
    var sessionKey = $get(‘_sessionKey’).value;
    PageMethods.GetSessionObject(sessionKey, OnSuccess);
    }
    function OnSuccess(result)
    {
    window.alert(result);
    }
    </script>
  3. You should consider declaring the following ScriptManager control on the page:
    <ScriptManager ID=”_scriptManager” runat=”server” EnablePageMethods=”true”/>
  4. You should consider declaring the following ScriptManager control on the page:
    <ScriptManager ID=”_scriptManager” runat=”server”>
    <Services>
    <asp:ServiceReference Path=”products.aspx”/>
    </Services>
    </ScriptManager>
  5. You should add the following script block to the page:
    <script language=”javascript” type=”text/javascript”>
    function GetSessionObject()
    {
    var sessionKey = $get(‘_sessionKey’).value;
    var result = PageMethods.GetSessionObject(sessionKey);
    window.alert(result);
    }
    </script>

Correct Answer: 2,3


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. In order toimplement partial rendering on a page you add the following markup:

<asp:ScriptManager ID="_scriptManager" runat="server"/>
<asp:UpdatePanel ID="updatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lbl1" runat="server"/>
<asp:Button ID="CKupdateButton" runat="server" Text="Update"/>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="updatePanel2" runat="server">
<ContentTemplate>
<asp:Label ID="lbl2" runat="server"/>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="CKupdateButton"/>
</Triggers>
</asp:UpdatePanel> 

You only want the content in the updatePanel2 control to be updated when the Button control named _btnUpd is clicked. You need to configure the page to accomplish this goal of the company. What should you do? (Choose all that apply)

  1. You should consider replacing AsyncPostBackTrigger with PostBackTrigger.
  2. You should consider setting the UpdateMode property of updatePanel2 to Conditional.
  3. You should consider setting the ChildrenAsTriggers property of updatePanel1 to false.
  4. You should consider setting the ChildrenAsTriggers property of updatePanel2 to false.
  5. You should consider setting the UpdateMode property of updatePanel1 to Conditional.
  6. You should consider setting the UpdateMode property of updatePanel2 to Always.

Correct Answer: 2,3,5


Question: You work as a Web Developer at Company.com. You are in the process of creating a Web application that uses Microsoft ASP.NET 3.5. The following markup exists on a page:

<asp:ScriptManager ID="_scriptManager" runat="server"/>
<asp:UpdatePanel ID="_updatePanel" runat="server">
<ContentTemplate>
<asp:GridView ID="_gridView" runat="server"/>
<asp:Button ID="_submitButton" runat="server" Text="Submit"/>
<asp:Button ID="_refreshButton" runat="server" Text="Refresh"/>
</ContentTemplate>
</asp:UpdatePanel> 

You want to add code in order that the _resetButton control will cause the entire page to be posted back. What should you do?

  1. You should use the code segment:
    protected void Page_Load(object sender, EventArgs e)
    {
    Page.RegisterRequiresRaiseEvent(_resetButton);
    }
  2. You should use the code segment:
    protected void Page_Load(object sender, EventArgs e)
    {
    Page.RegisterRequiresPostBack(_resetButton);
    }
  3. You should use the code segment:
    protected void Page_Load(object sender, EventArgs e)
    {
    _scriptManager.RegisterPostBackControl(_resetButton);
    }
  4. You should use the code segment:
    protected void Page_Load(object sender, EventArgs e)
    {
    _scriptManager.RegisterAsyncPostBackControl(_resetButton);
    }

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply