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

Question: You work as an application developer at Company.com. You decide to create an ASP.NET Web application on the companies’ network in Microsoft .NET Framework 3.5. Your application must not allow access to anonymous users but must support users from untrusted domains.
What should you do?

  1. Your best choice would be to add the code below to the Web.config file:
    <system.web>
    <authentication mode=”Windows”>
    </authentication>
    <authorization>
    <deny users=”?” />
    </authorization>
    </system.web>
  2. Your best choice would be to add the code below to the Web.config file:
    <system.web>
    <authentication mode=”Forms”>
    <forms loginUrl=”login.aspx” />
    </authentication>
    <authorization>
    <deny users=”*” />
    </authorization>
    </system.web>
  3. Your best choice would be to add the code below to the Web.config file:
    <system.web>
    <authentication mode=”Forms”>
    <forms loginUrl=”login.aspx” />
    </authentication>
    <authorization>
    <deny users=”?” />
    </authorization>
    </system.web>
  4. Your best choice would be to add the code below to the Web.config file:
    <system.web>
    <authentication mode=”Windows”>
    </authentication>
    <authorization>
    <deny users=”*” />
    </authorization>
    </system.web>

Correct Answer: 3


Question: You work as an application developer at Company.com. You are in the process of creating a Microsoft ASP.NET application that uses Microsoft .NET Framework 3.5. You have been instructed by management to set up authentication for the newly created Web application. You have to make sure that the Web application will be able to support users from untrusted domains. However, you need to make sure that users are not able to access the application anonymously. You thus need to determine the appropriate code that should be added to the Web.config file.
What should you do?

  1. You should consider adding the code segment below:
    <system.web>
    <authentication mode=”Windows”>
    </authentication>
    <authorization>
    <deny users=”?” />
    </authorization>
    </system.web>
  2. You should consider adding the code segment below:
    <system.web>
    <authentication mode=”Forms”>
    <forms loginUrl=”login.aspx” />
    </authentication>
    <authorization>
    <deny users=”*” />
    </authorization>
    </system.web>
  3. You should consider adding the code segment below:
    <system.web>
    <authentication mode=”Windows”>
    </authentication>
    <authorization>
    <deny users=”*” />
    </authorization>
    </system.web>
  4. You should consider adding the code segment below:
    <system.web>
    <authentication mode=”Forms”>
    <forms loginUrl=”login.aspx” />
    </authentication>
    <authorization>
    <deny users=”?” />
    </authorization>
    </system.web>

Correct Answer: 4


Question: You work as an application developer at Company.com. You are currently creating an ASP.NET Web application. You use Microsoft .NET Framework 3.5. This application will be hosted in the Marketing department. You need to make sure that Windows Authentication is used for the application. You have to make sure that the Marketing team has access to a confidential file named accs.xls. You therefore decide to set up the necessary NTFS file system permission to accomplish this. You check and discover that all Company.com users are able to access the accs.xls file.
What should you do?

  1. You should consider removing the rights from the application pool identity to the accs.xls file.
  2. You should consider adding <identity impersonate=”true”/> to the Web.config file.
  3. You should consider removing the NTFS permissions from the ASP.NET user to the accs.xls file.
  4. You should consider adding <authentication mode=”[None]”> to the Web.config file.

Correct Answer: 2


Question: You work as an application developer at Company.com. You make use of .NET Framework 3.5 to create an accounting application. The application makes use of a GridView named Accounts as shown below:

<asp:GridView ID="Accounts" runat="server" AllowSorting="True" DataSourceID="Cust">
</asp:GridView>
<asp:ObjectDataSource ID="Cust" runat="server" SelectMethod="GetData" TypeName="DAL" />
</asp:ObjectDataSource>

You then write the code below to bind data to the GridView using a Data Access Layer (DAL) class.

Public Function GetAccounts() As Object
Dim cnn As New SqlConnection
Dim strQuery As String = "SELECT * FROM Customers"
End Function 

You want to allow sorting of data on the GridView.
What should you do?

  1. You should consider adding the following code before End Function:
    Dim com As New SqlCommand(strQry, cnn)
    cnn.Open()
    Return cmd.ExecuteReader(CommandBehavior.KeyInfo)
  2. ou should consider adding the following code before End Function:
    Dim da As New SqlDataAdapter(strQuery, cnn)
    Dim ds As New DataSet()
    da.Fill(ds)
    ds.ExtendedProperties.Add(“Sortable”, True)
    Return ds.Tables(0).Select()
  3. You should consider adding the following code before End Function:
    Dim cmd As New SqlCommand(strQuery, cnn)
    cnn.Open()
    Return cmd.ExecuteReader()
  4. You should consider adding the following code before End Function:
    Dim da As New SqlDataAdapter(strQuery, cnn)
    Dim ds As New DataSet()
    da.Fill(ds)
    Return ds

Correct Answer: 4


Question: You work as an application developer at Company.com. You make use of Microsoft .NET Framework 3.5 to create a Microsoft ASP.NET application. You then add a TextBox control named DataBX to the application. You then write the subsequent code for authentication.

protected void CustVal1_ServerValidate(
object source, ServerValidateEventArgs args)
{
DateTime dt = String.IsNullOrEmpty(args.Value);
DateTime.Now : Convert.ToDateTime(args.Value);
args.IsValid = (DateTime.Now - dt).Days < 10;
}

It is important that you are able to authenticate the value of DataBX. You should thus identify the appropriate code fragment that has to be added to the Web page.
What should you do?

  1. You should consider adding the fragment below to the web page:
    <asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server” ControlToValidate=”DataBX” InitialValue=”<%= DateTime.Now; %>” >
    </asp:RequiredFieldValidator>
  2. You should consider adding the fragment below to the web page:
    <asp:CompareValidator ID=”CompareValidator1″ runat=”server” Type=”Date” EnableClientScript=”true” ControlToValidate=”DataBX” Operator=”DataTypeCheck” >
    </asp:CompareValidator>
  3. You should consider adding the fragment below to the web page:
    <asp:CustomValidator ID=”CustomValidator1″ runat=”server” ControlToValidate=”DataBX” onservervalidate=”CustomValidator1_ServerValidate”>
    </asp:CustomValidator>
  4. You should consider adding the fragment below to the web page:
    <asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server” ControlToValidate=”DataBX” EnableClientScript=”false” InitialValue=”<%= DateTime.Now; %>” >
    </asp:RequiredFieldValidator>
  5. You should consider adding the fragment below to the web page:
    <asp:CustomValidator ID=”CustomValidator1″ runat=”server” ControlToValidate=”TextBox1″ ValidateEmptyText=”True” onservervalidate=”CustomValidator1_ServerValidate”>
    </asp:CustomValidator>

Correct Answer: 3

Tagged . Bookmark the permalink.

Leave a Reply