Which code segment should you use?
Which code segment should you use?
You are implementing an ASP.NET application. You add the following code segment.
Public Function GetNonSecretUsers() As List(Of Person)
Dim secretUsers() As String =
{“@secretUser”, “@admin”, “@root”}
Dim allpeople As List(Of Person) = GetAllPeople()
…
End Function
You need to add code to return a list of all Person objects except those with a UserId that is
contained in the secretUsers list. The resulting list must not contain duplicates. Which code segment
should you use?
You need to ensure that Address instances that are serialized by the XmlSerializer class meet the XML format r
You are implementing an ASP.NET Web site. The site contains the following class.
public class Address
{
public int AddressType;
public string Line1;
public string Line2;
public string City;
public string ZipPostalCode;
}
The Web site interacts with an external data service that requires Address instances to be given in
the following XML format.
<Address AddressType=”2″>
<Line1>250 Race Court</Line1>
<City>Chicago</City>
<PostalCode>60603</PostalCode>
</Address>
You need to ensure that Address instances that are serialized by the XmlSerializer class meet the
XML format requirements of the external data service. Which two actions should you perform (Each
correct answer presents part of the solution. Choose two.)
Which two actions should you perform?
You are implementing a new Dynamic Data Web site. The Web site includes a Web page that has an
ObjectDataSource control named ObjectDataSource1. ObjectDataSource1 interacts with a Web
service that exposes methods for listing and editing instances of a cla named Product. You add a
GridView control named GridView1 to the page, and you specify that GridView1 should use
ObjectDataSource1 as its data source. You then configure GridView1 to auto-generate fields and to
enable editing. You need to add Dynamic Data behavior to GridView1. You also must ensure that
users can use GridView1 to update Product instances. Which two actions should you perform? (Each
correct answer presents part of the solution. Choose two.)
What are two possible attributes that you can add to the Edit action to achieve this goal?
You are implementing an ASP.NET MVC 2 Web application that allows users to view and edit data.
You need to ensure that only logged-in users can access the Edit action of the controller. What are
two possible attributes that you can add to the Edit action to achieve this goal? (Each correct answer
presents a complete solution. Choose two.)
Which code segment should you use?
You create an ASP.NET MVC 2 Web application. You implement a single project area in the
application. In the Areas folder, you add a subfolder named Test. You add files named
TestController.cs and Details.aspx to the appropriate subfolders. You register the area’s route,
setting the route name to test_default and the area name to test. You create a view named Info.aspx
that is outside the test are A. You need to add a link to Info.aspx that points to Details. aspx. Which
code segment should you use?
Which code segment should you use?
Which two actions should you perform?
You are implementing an ASP.NET page that hosts a user control named CachedControl. You need to
ensure that the content of the user control is cached for 10 seconds and that it is regenerated when
fetched after the 10 seconds elapse. Which two actions should you perform? (Each correct answer
presents part of the solution. Choose two.)
You need to ensure that the menu items are populated from an array of strings in your code-behind file
You create a Web page that has an ASP.NET menu. You need to ensure that the menu items are
populated from an array of strings in your code-behind file. What should you do?
You need to display the user input in the Web page so that a cross-site scripting attack will be prevented
You are implementing a Web page that displays text that was typed by a user. You need to display
the user input in the Web page so that a cross-site scripting attack will be prevented. What should
you do?