1. Question 1 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. You are not using
an exception management framework in the application. However, the
application must automatically log all unhandled exceptions to the event log.
You need to configure the Web.config file accordingly.
Which configuration should you use?
<healthMonitoring enabled="true"/>
<deployment retail="true"/>
<customErrors mode="On"/>
<trace enabled="true"/>
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-051 Jump to Question ID
Question 1 Explanation:
You should set the enabled attribute of the healthMonitoring element to true. This
enables health monitoring. Health monitoring defines events to be monitored, providers
that deliver the events, and rules that map events to providers. The root Web.config is
configured to deliver all unhandled exceptions to the event log. However, it sets the
enabled attribute to false, which is why you must set it to true in the application's
Web.config file.
You should not configure the customErrors element. This element allows you to specify
how the application displays unhandled exceptions.
2. You should not configure the trace element. This element allows you to enable and
configure ASP.NET tracing.
You should not configure the deployment element. This element only has meaning in
the machine.config file. When the retail attribute is set to true, features such as custom
errors, ASP.NET tracing, and debugging are disabled.
Objective:
List all
questions
for this
objective</ Troubleshooting and Debugging
P< td>
Web Applications
Sub-Objective:
4.6 Monitor Web applications.
2. You create a Web site by using Microsoft ASP.NET 3.5. You create the following class
in a separate code file:
public static class ChartColors
{
public static Color NormalActivityColor = Color.Green;
public static Color WarningActivityColor = Color.Yellow;
public static Color ErrorActivityColor = Color.Red;
public static Color GetRandomColor()
{
Random random = new Random((int)DateTime.Now.Ticks);
int randomArgbValue = random.Next();
Color color = Color.FromArgb(255, Color.FromArgb(randomArgbValue));
return color;
}
}
You need to configure the Web site project so that this class can be consumed by the
Web site.
3. What should you do?
Add the file to the App_Code folder of the project.
Add a Register directive that references the file to each page that consumes the
class.
Reference the file in the assemblies section of the Web.config file.
Reference the file in the httpHandlers section of the Web.config file.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-004 Jump to Question ID
Question 2 Explanation:
You should add the file to the App_Code folder of the project. The App_Code folder
allows you to store utility classes for users in a Web site project. Code placed in this
folder is dynamically compiled into an assembly.
You should not reference the file in the assemblies section of the Web.config file. You
should reference binary assemblies in the assemblies section. In this scenario, the code
file is not a binary assembly because the code is not yet compiled.
You should not add a Register directive that references the file to each page that
consumes the class. You should use the Register directive to reference files containing
user controls or assemblies containing server controls.
You should not reference the file in the httpHandlers section of the Web.config file. You
should use the httpHandlers section to reference classes that implement the
IHttpHandler interface. In this scenario, the ChartColors class does not implement an
interface.
4. Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
Sub-Objective:
7.4 Implement business objects and utility classes.
References:
Question 3 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The following
code exists in the code-behind file for a page:
private void Process(Location[] locations)
{
if (_scriptManager.IsInAsyncPostBack)
{
JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
string jsonArray = jsonSerializer.Serialize(locations);
_scriptManager.RegisterDataItem(_locationGridView, jsonArray, true);
}
}
This code creates a JavaScript Object Notation (JSON) array from an array of
Location instances. The _locationGridView control is contained within four
nested naming containers on the page.
You need to access the JSON array from client script.
Which code segment should you use?
5. Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(OnL
oaded);
function OnLoaded(sender, args)
{
var dataItems = args.get_dataItems();
var locations = dataItems['<%= _locationGridView.ClientID %>'];
}
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(OnRequest);
function OnRequest(sender, args)
{
var dataItems = args.get_postBackElement();
var locations = dataItems['_locationGridView'];
}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(OnLoading);
function OnLoading(sender, args)
{
var dataItems = args.get_dataItems();
var locations = dataItems['_locationGridView'];
}
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(OnInit);
function OnInit(sender, args)
{
var dataItems = args.get_postBackElement();
var locations = dataItems['<%= _locationGridView.ClientID %>'];
}
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-019 Jump to Question ID
Question 3 Explanation:
You should use the following code segment:
Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(OnLoaded);
function OnLoaded(sender, args)
{
var dataItems = args.get_dataItems();
var locations = dataItems['<%= _locationGridView.ClientID %>'];
}
This code creates an event handler for the pageLoaded Asynchronous JavaScript and
XML (AJAX) event. This event is raised after an AJAX request is completed and page
6. regions are updated. The event handler defines a PageLoadedEventArgs parameter that
represents the event arguments. The PageLoadedEventArgs object contains a property
named dataItems that contains all data items registered by the call to the
RegisterDataItem method of the ScriptManager class. The data items are indexed by
the client IDs of the controls that were specified in the call to the RegisterDataItem
method. In this scenario, the code passed the _locationGridView control instance to the
RegisterDataItem method to register a JSON array as a data item. To access this array,
you must use the client ID of the _locationGridView control instance. Because the
_locationGridView control is contained with four nested naming containers, this code
uses the <%= _locationGridView.ClientID %> syntax to obtain the client ID of the
_locationGridView control. When a control is contained within nested naming
containers, its client ID is prefixed with the names of the naming containers.
You should not use the following code segment:
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(OnRequest);
function OnRequest(sender, args)
{
var dataItems = args.get_postBackElement();
var locations = dataItems['_locationGridView'];
}
This code creates an event handler for the beginRequest AJAX event. This event is
raised after an AJAX request is initiated but before the request is sent to the server.
Items registered by using the RegisterDataItem method of the ScriptManager class can
only be accessed in pageLoaded, pageLoading and endRequest events of
PageRequestManager.
You should not use the following code segment:
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(OnInit);
function OnInit(sender, args)
{
var dataItems = args.get_postBackElement();
var locations = dataItems['<%= _locationGridView.ClientID %>'];
}
This code creates an event handler for the initializeRequest AJAX event. This event is
raised before an AJAX request is initialized. Items registered by using the
RegisterDataItem method of the ScriptManager class can only be accessed in
pageLoaded, pageLoading and endRequest events of PageRequestManager.
You should not use the following code segment:
7. Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(OnLoading);
function OnLoading(sender, args)
{
var dataItems = args.get_dataItems();
var locations = dataItems['_locationGridView'];
}
This code creates an event handler for the pageLoading AJAX event. This event is raised
after an AJAX request has completed but before page regions are updated. You can
access registered data items from this event handler. However, this code uses the string
"_locationGridView" to index the data items. According to the scenario, the
_locationGridView control is contained within four nested naming containers on the
page. This means that its client ID is prefixed with the names of the naming containers.
Objective:
List all
questions
for this
objective</ Working with ASP.NET AJAX and
P< td>
Client-Side Scripting
Sub-Objective:
5.2 Interact with the ASP.NET AJAX client-side library.
References:
1. ScriptManager.RegisterDataItem Method (Control, String, Boolean)
Click here for further information
MSDN, Microsoft
2. Sys.WebForms.PageRequestManager pageLoaded Event
Click here for further information
MSDN, Microsoft
3. Sys.WebForms.PageLoadedEventArgs Class
Click here for further information
MSDN, Microsoft
8. 4. An Introduction to JavaScript Object Notation (JSON) in JavaScript and .NET
Click here for further information
MSDN, Microsoft
Question 4 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The following
markup exists on a page:
<asp:TextBox ID="_titleTextBox" runat="server"/>
<asp:Button ID="_button" runat="server" Text="Filter"/>
<asp:SqlDataSource
ID="_bookDataSource"
runat="server"
ConnectionString="<%$ ConnectionStrings:Publishing %>"
SelectCommand="GetBooks"
SelectCommandType="StoredProcedure"
FilterExpression="Active=1 AND Title LIKE '{0}%'">
<FilterParameters>
<asp:ControlParameter ControlID="_titleTextBox"/>
</FilterParameters>
</asp:SqlDataSource>
<asp:GridView ID="_bookGridView" runat="server"
DataSourceID="_bookDataSource"/>
The page retrieves all books in the company's database and displays only the
active books. The TextBox control allows you to also filter books by title. When
you click the Filter button and do not specify a title, the page does not filter by
active books. It displays all books retrieved from the database. If you do not
specify a title, you want the page to display only active books.
You need to solve this problem.
What should you do?
Set the Name property of the ControlParameter control.
Set the PropertyName property of the ControlParameter control to Text.
Set the ControlParameter control's ConvertEmptyStringToNull property to
false.
9. Replace the {0} placeholder in the FilterExpression property with the (?) symbol.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-064 Jump to Question ID
Question 4 Explanation:
You should set the ControlParameter control's ConvertEmptyStringToNull property to
false. When using FilterExpression and FilterParameters, if one of the evaluated values
for the FilterParameters collection is null, then the data will not get filtered at all. To
accommodate this, you should set the ConvertEmptyStringToNull property to false. The
default value of this property is true. This means that if you do not specify a title, the
parameter converts the empty string returned by the Text property of the TextBox
control to null. Setting the value to false will cause the empty string to be passed to the
data source.
You should not replace the {0} placeholder with the (?) symbol. You must use format
placeholders in the FilterExpression property. The value of each parameter in the
FilterParameters collection will replace the format placeholders in the FilterExpression
property when the data is filtered.
You should not set the Name property of the ControlParameter control to solve this
problem. You must set the Name property when using select parameters, insert
parameters, update parameters, or delete parameters when executing SQL commands
that use named parameters, such as @param1.
You should not set the PropertyName property of the ControlParemeter control to Text
to solve this problem. If you do not set the PropertyName property, the
ControlParameter control determines whether the ControlValueProperty attribute is
applied to the control specified by the ControlID property. If so, the ControlParameter
property uses this attribute to obtain the value of the associated control. The
ControlValueProperty attribute applied to the TextBox class specifies Text as the default
property for ControlParameter controls.
10. Objective:
List all
questions
for this
objective</ Working with Data and Services
P< td>
Sub-Objective:
3.4 Implement a DataSource control.
References:
1. SqlDataSource Web Server Control Declarative Syntax
Click here for further information
MSDN, Microsoft
2. Handling Null Database Values Using Data Source Controls
Click here for further information
MSDN, Microsoft
3. Filtering Data Using Data Source Controls
Click here for further information
MSDN, Microsoft
Question 5 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The following
HTML element exists on an ASP.NET page:
<input type="hidden" name="HiddenField"/>
You need to retrieve the value of the element in the code-behind class.
Which code segment should you use? (Each correct answer presents a
11. complete solution. Choose two.)
string value = Application["HiddenField"];
string value = ((HtmlInputHidden)Page.FindControl("HiddenField")).Value;
string value = Request.Params["HiddenField"];
string value = Request.Form["HiddenField"];
string value = Context["HiddenField"];
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-006 Jump to Question ID
Question 5 Explanation:
You should access the HiddenField item from the Request.Form collection. This
collection contains all HTML form fields that are rendered by the page. This includes
HTML Input elements.
Alternatively, you can access the HiddenField item of the Request.Params collection.
This collection contains HTML form fields, query string paramers, HTTP server variables,
and cookies.
You should not access items of the current HttpApplicationState instance. An
HttpApplicationState instance is created for each instance of an ASP.NET application.
However, HTML form fields are not automatically stored in HttpContext instances.
You should not access items of the current HttpContext instance. An HttpContext
instance is created during each HTTP request to an application. However, HTML form
fields are not automatically stored in HttpContext instances.
You should not call the FindControl method of the Page class to retrieve the HTML Input
element. The FindControl method finds server controls only. In this scenario, the HTML
Input element is not a server control because it is missing the runat=server attribute.
12. Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
Sub-Objective:
7.2 Work with ASP.NET intrinsic objects.
References:
1. HttpRequest.Form Property
Click here for further information
MSDN, Microsoft
2. HttpRequest.Params Property
Click here for further information
MSDN, Microsoft
3. ASP.NET Intrinsic Objects
Click here for further information
MSDN, Microsoft
Question 6 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. An Extensible
Markup Language (XML) Web service is defined as follows:
[WebService]
public class PhoneService : WebService
{
[WebMethod]
public string[] GetAvailableNumbers()
13. {
// Omitted for brevity
}
}
You use Microsoft Visual Studio 2008 to add a Web reference named
TelephoneServices to the application's project.
You need to call the GetAvailableNumbers Web method from a page.
Which code segment should you use?
WebService baseService = new WebService();
TelephoneServices.PhoneService service =
baseService.GetService(typeof(TelephoneServices.PhoneService));
string[] numbers = service.GetAvailableNumbers();
TelephoneServices.PhoneService service = new
TelephoneServices.PhoneService();
string[] numbers = service.GetAvailableNumbers();
ChannelFactory<PhoneService> factory = new ChannelFactory<PhoneService>();
PhoneService service = factory.CreateChannel();
string[] numbers = service.GetAvailableNumbers();
ChannelFactory<WebService> factory = new ChannelFactory<WebService>();
PhoneService service = (PhoneService)factory.CreateChannel();
string[] numbers = service.GetAvailableNumbers();
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-020 Jump to Question ID
Question 6 Explanation:
You should create an instance of the TelephoneServices.PhoneService proxy class and
call its GetAvailableNumbers method. When you use Visual Studio to add a Web
reference to a Web service, Visual Studio generates a proxy class that contains the
same methods as the Web service. Calls made to the proxy methods are marshaled and
sent to the corresponding Web methods.
You should not use the ChannelFactory generic type to create a channel from the
PhoneService proxy class. The type of channel you create must implement
IOutputChannel or IRequestChannel. Web service proxy classes generated by Visual
Studio do not implement either of these interfaces.
14. You should not call the GetService method of the WebService class to create a
PhoneService proxy instance. You must create the proxy instance by calling the
PhoneService proxy class constructor.
You should not use the ChannelFactory generic type to create a channel from the
WebService class. The type of channel you create must implement IOutputChannel or
IRequestChannel. The WebService class does not implement either of these interfaces.
Objective:
List all
questions
for this
objective</ Working with Data and Services
P< td>
Sub-Objective:
3.3 Call a Windows Communication Foundation (WCF) service or a Web service from an
ASP.NET Web page.
References:
1. How to: Access a Web Service in Managed Code
Click here for further information
MSDN, Microsoft
2. How to: Add a Web Service to an Existing Web Project in Managed Code
Click here for further information
MSDN, Microsoft
3. How to: Call a Web Service
Click here for further information
MSDN, Microsoft
15. Question 7 / 75 Mark for Review
You create a Web site by using Microsoft ASP.NET 3.5. The following code
exists in the App_Code folder:
public class ObjectParameter : Parameter
{
public string ObjectTypeName {get; set; }
public string PropertyName {get; set; }
protected override object Evaluate(HttpContext context, Control control)
{
if (String.IsNullOrEmpty(ObjectTypeName))
{
throw new InvalidOperationException("ObjectTypeName is not set");
}
if (String.IsNullOrEmpty(PropertyName))
{
throw new InvalidOperationException("PropertyName is not set");
}
Type type = System.Type.GetType(ObjectTypeName);
BindingFlags flags = BindingFlags.Public | BindingFlags.Static |
BindingFlags.GetProperty;
object value = type.InvokeMember(flags, null, null, null);
return value;
}
}
public static class Security
{
public static string UserID
{
get { return Session["UserID"]; }
}
}
The following stored procedure exists in a Microsoft SQL Server 2008
database:
CREATE PROCEDURE GetStoresByUser @UserID INT AS
SELECT StoreID, StoreName FROM Store where UserID=@UserID
The connection string to the database is stored in the connectionStrings
section and has the name SupplyChain.
You need to use a data source control to call this stored procedure and pass
the Security.UserID value to it as a parameter.
16. Which declaration should you use?
<SqlDataSource ID="_dataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:SupplyChain%>"
SelectCommand="GetStoresByUser"
SelectCommandType="Text">
<SelectParameters>
<cust:ObjectParameter Name="Security.UserID"/>
</SqlDataSource>
<ObjectDataSource ID="_dataSource" runat="server"
DataObjectTypeName="<%$ ConnectionStrings:SupplyChain%>"
TypeName="StoredProcedure"
SelectMethod="GetStoresByUser">
<SelectParameters>
<cust:ObjectParameter
Name="UserID"
ObjectTypeName="Security"
PropertyName="UserID"/>
</SelectParameters>
</ObjectDataSource>
<SqlDataSource ID="_dataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:SupplyChain%>"
SelectCommand="GetStoresByUser"
SelectCommandType="StoredProcedure">
<SelectParameters>
<cust:ObjectParameter
Name="UserID"
ObjectTypeName="Security"
PropertyName="UserID"/>
</SelectParameters>
</SqlDataSource>
<ObjectDataSource ID="_dataSource" runat="server"
DataObjectTypeName="StoredProcedure"
TypeName="ConnectionStrings.SupplyChain"
SelectMethod="GetStoresByUser">
<SelectParameters>
<cust:ObjectParameter Name="Security.UserID"/>
</SelectParameters>
</ObjectDataSource>
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-016 Jump to Question ID
Question 7 Explanation:
17. You should use the following declaration:
<SqlDataSource ID="_dataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:SupplyChain%>"
SelectCommand="GetStoresByUser"
SelectCommandType="StoredProcedure">
<SelectParameters>
<cust:ObjectParameter
Name="UserID"
ObjectTypeName="Security"
PropertyName="UserID"/>
</SelectParameters>
</SqlDataSource>
This declares a SqlDataSource control that connects to the database. The
SelectCommand property specifies the SQL command or stored procedure to execute.
In this scenario, the SelectCommandType property is set to StoredProcedure, so the
value specified in the SelectCommand property is a stored procedure. The
SelectParameters property defines the parameters to pass to the stored procedure. In
this scenario, the stored procedure accepts a single String parameter. To pass the value
of Security.UserID as a parameter, you should use the ObjectParameter class and set its
properties appropriately. The ObjectTypeName property specifies the name of the class,
and the PropertyName property specifies the property of that class. In this scenario, the
name of the class is Security, and the name of the property of that class is UserID.
You should not use the ObjectDataSource control. This control allows you to bind to
business or data objects. The TypeName property of this control should specify the
common language runtime (CLR) type of the object to query. The SelectMethod
property should specify a method of that type that is used to query data. The
DataObjectTypeName property should specify a CLR type that can be used for a
parameter in an insert, update, or delete operation.
You should not use the following declaration:
<SqlDataSource ID="_dataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:SupplyChain%>"
SelectCommand="GetStoresByUser"
SelectCommandType="Text">
<SelectParameters>
<cust:ObjectParameter Name="Security.UserID"/>
</SqlDataSource>
This code sets the SelectCommandType property to Text, which indicates that the
18. SelectCommand property value is a SQL statement. Also, the ObjectParameter property
does not set the ObjectTypeName and PropertyName properties, but instead sets the
Name property to Security.UserID. You must set the Name property to the name of a
parameter expected by the stored procedure. Also, in this scenario, if you do not set the
ObjectTypeName and PropertyName properties, the ObjectParameter class throws an
exception.
Objective:
List all
questions
for this
objective</ Working with Data and Services
P< td>
Sub-Objective:
3.4 Implement a DataSource control.
References:
1. Parameter Class
Click here for further information
MSDN, Microsoft
2. Using Parameters with the SqlDataSource Control
Click here for further information
MSDN, Microsoft
Question 8 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The application is
hosted on a Web farm, and it uses in-process session state. It is not
guaranteed that a user will remain connected to the same Web server across
multiple requests.
19. A Web page contains the following code (line numbers are included for
reference only):
01 protected void Page_Load(object sender, EventArgs e)
02 {
03 String connStr =
WebConfigurationManager.ConnectionStrings[0].ConnectionString;
04 using (SqlConnection conn = new SqlConnection(connStr))
05 {
06 SqlCommand cmd = new SqlCommand("GetExams", conn);
07 SqlDataAdapter adapter = new SqlDataAdapter(cmd);
08 DataSet ds = new DataSet();
09 adapter.Fill(ds);
10
11 if (Request.QueryString["Process"] == Boolean.TrueString)
12 {
13
14 }
15 }
16 }
This code fills a DataSet instance with exam information from a Microsoft SQL
Server database. If a query string parameter named Process has the value
True, you need to have a page named ExamProcesser.aspx access the data in
the DataSet instance.
You need to add code at line 13 to accomplish your goal.
Which code segment should you use?
Session["ExamInfo"] = ds;
HttpWebRequest.Create("ExamProcesser.aspx").GetResponse();
Context.Items.Add("ExamInfo", ds);
Response.Redirect("ExamProcesser.aspx");
Session["ExamInfo"] = ds;
Response.RedirectLocation = "ExamProcesser.aspx";
Context.Items.Add("ExamInfo", ds);
Server.Transfer("ExamProcesser.aspx");
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-002 Jump to Question ID
Question 8 Explanation:
20. You should store the DataSet instance in the current HttpContext instance and call the
Transfer method of the HttpServerUtility class. The Transfer method transfers the
current request to another page or HTTP handler without having the browser perform a
redirect. An HttpContext instance gets created with each request to the application.
This means that any data currently stored in the current HttpContext instance will be
available after the transfer.
You should not call the Redirect method of the HttpResponse class. This method sends
an HTTP response to the browser that instructs the browser to request the specified
page. Because the application is hosted on a Web farm, a user might be redirected to
another server with the request. If this happens, the DataSet instance stored in the
current HttpContext instance will get removed.
You should not store the DataSet instance in the user's HttpSessionState instance and
call the GetResponse method of an HttpWebRequest instance. The GetResponse method
of the HttpWebRequest instance sends an HTTP request to a Web server. In this
scenario, the Web server to which the user is currently connected will initiate the
request. This means the session associated with that request will be different from the
one associated with the user.
You should not store the DataSet instance in the user's HttpSessionState instance and
set the RedirectLocation property of the HttpResponse class. The RedirectLocation
property instructs the browser to request the page indicated by the specified URL. The
application uses in-process session state, which means that a user's session is not
shared across multiple Web servers. Because the application is hosted on a Web farm, a
user might be redirected to another server.
Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
Sub-Objective:
7.6 Handle events and control page flow.
References:
1. Server.Transfer Method
21. Click here for further information
MSDN, Microsoft
2. How to: Redirect Users to Another Page
Click here for further information
MSDN, Microsoft
Question 9 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. You create a
page named GenericError.aspx that displays a message to the user when an
unhandled exception occurs. Most users access the application at
http://www.bcdtrain.com/Crm. If the user accesses the application at
http://127.0.0.1/Crm, the application must display an automatically generated
page containing the stack trace when an unhandled exception occurs.
You need to configure the Web.config file accordingly.
Which configuration should you use?
<customErrors mode="Off">
<error statusCode="500" redirect="GenericError.aspx">
</customErrors>
<customErrors mode="RemoteOnly"
defaultRedirect="GenericError.aspx">
</customErrors>
<customErrors mode="On">
<error statusCode="500" redirect="GenericError.aspx">
</customErrors>
<customErrors mode="Off" defaultRedirect="GenericError.aspx">
</customErrors>
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
22. Development (C#) (Preview)
Question ID: jehMS_70-562CS-043 Jump to Question ID
Question 9 Explanation:
You should configure the customErrors element to indicate how the application displays
unhandled exceptions. You should set the defaultRedirect attribute to GenericError.aspx.
This attribute specifies the default URL to which the application will redirect when an
unhandled exception occurs. You should set the mode attribute to RemoteOnly. This
attribute specifies that only unhandled exceptions from remote users will cause the
application to redirect to GenericError.aspx. In the context of custom errors, local users
are those who access the application at http://127.0.0.1/Crm. All other users are
considered remote users. When the mode attribute is set to RemoteOnly, local users
see an automatically generated page containing the stack trace when unhandled
exceptions occur.
You should not set the mode attribute to On. This specifies that the application should
never display the automatically generated page containing the stack trace when
unhandled exceptions occur.
You should not set the mode attribute to Off. This specifies that the application should
always display the automatically generated page containing the stack trace when
unhandled exceptions occur.
Objective:
List all
questions
for this
objective</ Troubleshooting and Debugging
P< td>
Web Applications
Sub-Objective:
4.1 Configure debugging and custom errors.
References:
1. customErrors Element (ASP.NET Settings Schema)
Click here for further information
MSDN, Microsoft
23. 2. Rich Custom Error Handling with ASP.NET
Click here for further information
MSDN, Microsoft
Question 10 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. You add a the
following code to a generic handler file named ValidationHandler.ashx (line
numbers are included for reference only):
01 public class ValidationHandler : IHttpHandler
02 {
03 public void ProcessRequest(HttpContext context)
04 {
05 Bitmap validationBitmap = (Bitmap)Session["ValidationImage"];
06
07 }
08 public bool IsReusable
09 {
10 get
11 {
12 return false;
13 }
14 }
15 }
You need to render the validationBitmap instance as a JPEG image when the
ValidationHandler.ashx is requested.
Which code segment should you add at line 06?
context.Response.ContentType = "image/jpeg";
context.Response.Write(validationBitmap);
context.Response.ContentType = "image/jpeg";
validationBitmap.Save(context.Request.InputStream, ImageFormat.Jpeg);
context.Response.ContentType = "image/jpeg";
context.Response.Write(validationBitmap.RawFormat);
context.Response.ContentType = "image/jpeg";
24. validationBitmap.Save(context.Response.OutputStream,
ImageFormat.Jpeg);
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-001 Jump to Question ID
Question 10 Explanation:
You should set the Response.ContentType property of the context instance to
image/jpeg, and you should call the Save method of the validationBitmap instance. The
ContentType property specifies the type of content that is rendered by the generic
handler. By setting the value of the property to image/jpeg, you specify that a JPEG
image is rendered. The Save method of the Bitmap class allows you to save an image to
a file or Stream instance. The Response.OutputStream property of the HttpContext
class represents the output stream of the HTTP response. You should use this stream to
render the image to the browser. You can accomplish this by passing the
context.Response.OutputStream instance as the first parameter to the Save method.
The second parameter of the Save method specifies the format in which to save the
image.
You should not pass the context.Request.InputStream instance as the first parameter to
the Save method. This instance represents the input stream of the HTTP request.
You should not pass the validationBitmap instance as the parameter to the Write
method of the context.Response instance. This would call the ToString method of the
validationBitmap instance, which does not render the image to the browser.
You should not pass the validationBitmap.RawFormat instance as the parameter to the
Write method of the context.Response instance. This would call the ToString method of
the validationBitmap.ImageFormat instance, which does not render the image to the
browser.
Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
25. Sub-Objective:
7.7 Implement the Generic Handler.
References:
1. Introduction to HTTP Handlers
Click here for further information
MSDN, Microsoft
2. ASP.NET: Create Snazzy Web Charts and Graphics on the Fly with the .NET Framework
Click here for further information
MSDN, Microsoft
Question 11 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The application
uses diagnostic tracing to log unhandled exceptions. A page contains the
following markup:
<asp:ScriptManager ID="_scriptManager" runat="server"/>
<asp:UpdatePanel ID="_udpatePanel" runat="server">
<asp:Button ID="_button" runat="server" Text="Process"/>
</asp:UpdatePanel>
When you click the Button control an unhandled exception occurs. However,
the exception does not get logged.
You need to configure the application so that the unhandled exception
produced by clicking the Button control gets logged.
What should you do?
Handle the Error event of the Page class. Call the Write method of the
System.Diagnostics.Trace class to log the exception.
Handle the pageLoaded event of the PageRequestManager client object. Call the
trace function of the Sys.Debug client object to log the exception.
26. Handle the endRequest event of the PageRequestManager client object. Call the
trace function of the Sys.Debug client object to log the exception.
Handle the AsyncPostBackError event of the ScriptManager control. Call
the Write method of the System.Diagnostics.Trace class to log the
exception.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-047 Jump to Question ID
Question 11 Explanation:
You should handle the AsyncPostBackError event of the ScriptManager control and call
the Write method of the System.Diagnostics.Trace class to log the exception. The
AsyncPostBackError event is raised whenever an unhandled exception occurs during an
asynchronous post back. Because the Button control is a child of the UpdatePanel
control, the Button control performs an asynchronous post back by default when it is
clicked. The System.Diagnostics.Trace class allows you to write diagnostic trace
messages.
You should not handle the Error event of the Page class. This event is raised when
unhandled exceptions occur during synchronous post backs, not asynchronous post
backs.
You should not handle the endRequest event of the PageRequestManager client object
and call the trace function of the Sys.Debug client object. The endRequest event is
raised on the client when an asynchronous request ends. The Sys.Debug.trace function
writes messages to a TextArea element that has an ID of TraceConsole. It does not
implement diagnostic tracing.
You should not handle the pageLoaded event of the PageRequestManager client object
and call the trace function of the Sys.Debug client object. The pageLoaded event is
raised on the client after an asynchronous request ends and UpdatePanel control
regions are updated. The Sys.Debug.trace function writes messages to a TextArea
element that has an ID of TraceConsole. It does not implement diagnostic tracing.
27. Objective:
List all
questions
for this
objective</ Troubleshooting and Debugging
P< td>
Web Applications
Sub-Objective:
4.3 Debug unhandled exceptions when using ASP.NET AJAX.
References:
1. Debugging and Tracing AJAX Applications Overview
Click here for further information
MSDN, Microsoft
2. ScriptManager.AsyncPostBackErrorMessage Property
Click here for further information
MSDN, Microsoft
3. Customizing Error Handling for ASP.NET UpdatePanel Controls
Click here for further information
MSDN, Microsoft
4. ScriptManager Control Overview
Click here for further information
MSDN, Microsoft
5. Trace Class
Click here for further information
MSDN, Microsoft
28. Question 12 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The following
Asynchronous JavaScript and XML (AJAX)-enabled Windows Communication
Foundation (WFC) service exists in an ASP.NET Web application:
namespace BcdTrain.Information.Services
{
[ServiceContract(Namespace="BcdTrain.Services")]
public class SearchService
{
[OperationContract]
public string LookupPhoneNumber(string phoneNumber)
{
// Code omitted for brevity
}
}
}
You add the ScriptManager control to a page and reference the service. You
also add a TextBox control named _phoneNumberTextBox. You need to call the
LookupPhoneNumber method, passing to it the text displayed in the TextBox
control. You must also display the return value of the method in a browser
alert window. The naming container of the TextBox control is the page.
You need to write the appropriate JavaScript code to call the
LookupPhoneNumber method.
Which code segment should you use?
var phoneNumber = $get("_phoneNumberTextBox").value;
BcdTrain.Information.Services.SearchService.LookupPhoneNumber(phoneNumber)
;
window.alert($get("ReturnValue").value);
var phoneNumber = $get("_phoneNumberTextBox").value;
var result = BcdTrain.
Services.SearchService.LookupPhoneNumber(phoneNumber);
window.alert(result);
var phoneNumber = $get("_phoneNumberTextBox").value;
BcdTrain.Services.SearchService.LookupPhoneNumber(phoneNumber, OnSuccess);
function OnSuccess()
{
window.alert($get("ReturnValue").value);
}
29. var phoneNumber = $get("_phoneNumberTextBox").value;
BcdTrain.Services.SearchService.LookupPhoneNumber(phoneNumber,
OnSuccess);
function OnSuccess(result)
{
window.alert(result);
}
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-015 Jump to Question ID
Question 12 Explanation:
You should use the following JavaScript code segment:
var phoneNumber = $get("_phoneNumberTextBox").value;
BcdTrain.Services.SearchService.LookupPhoneNumber(phoneNumber, OnSuccess);
function OnSuccess(result)
{
window.alert(result);
}
The first line of code retrieves the value of the TextBox control, which will be passed to
the LookupPhoneNumber method of SearchService. The second line of code makes a
call to the method. When calling AJAX-enabled Web services from JavaScript, you must
specify the service contract's XML namespace as the JavaScript namespace. The reason
is because ASP.NET AJAX creates a JavaScript Object Notation (JSON) class that is part
of a namespace that uses the same name as the service contract's XML namespace.
Because the default XML namespace is always http://tempura.org, this allows ASP.NET
AJAX to register a namespace even if a service contract is not part of a .NET
namespace. The first parameters to the JSON function match the first parameters to the
.NET method. In addition, the JSON function accepts another parameter that specifies
another JavaScript function to call after the service method returns. This function
accepts a single parameter that specifies the return value of the service method call.
You should not use the following JavaScript code segment:
var phoneNumber = $get("_phoneNumberTextBox").value;
BcdTrain.Information.Services.SearchService.LookupPhoneNumber(phoneNumber);
30. window.alert($get("ReturnValue").value);
This code uses the .NET namespace instead of the service contract's namespace, which
was used to register the JSON namespace. Also, this code does not specify a second
parameter to identify the JavaScript function to call after the service method returns.
You should not use $get to access the return value. The $get function retrieves
Document Object Model (DOM) elements in a browser-independent way.
You should not use the following JavaScript code segment:
var phoneNumber = $get("_phoneNumberTextBox").value;
BcdTrain.Services.SearchService.LookupPhoneNumber(phoneNumber, OnSuccess);
function OnSuccess()
{
window.alert($get("ReturnValue").value);
}
This code does not declare the OnSuccess function correctly. The function must accept a
single parameter that specifies the return value of the service method call. The $get
function retrieves DOM elements in a browser-independent way.
You should not use the following JavaScript code segment:
var phoneNumber = $get("_phoneNumberTextBox").value;
var result = BcdTrain. Services.SearchService.LookupPhoneNumber(phoneNumber);
window.alert(result);
The LookupPhoneNumber JSON function does not return a value. You must specify
another JavaScript function to retrieve the return value of the service method call.
Objective:
List all
questions
for this
objective</ Working with ASP.NET AJAX and
P< td>
Client-Side Scripting
Sub-Objective:
31. 5.3 Consume services from client scripts.
References:
1. Exposing WCF Services to Client Script
Click here for further information
MSDN, Microsoft
2. Calling Web Services from Client Script
Click here for further information
MSDN, Microsoft
3. An Introduction to JavaScript Object Notation (JSON) in JavaScript and .NET
Click here for further information
MSDN, Microsoft
Question 13 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. You create a
base user control named AssignmentUserControl. Ten user controls derive
from AssignmentUserControl. You add a PlaceHolder control named
_placeHolder to a page. You create the following method to load one of the 10
user controls into _placeHolder:
private void DisplayAssignmentUserControl(string userControlPath)
{
}
The path of the user control to load is passed as a parameter to the method.
You need to write code to load the user control. Your solution must support
new AssignmentUserControl-derived user controls without the need to re-
implement the method.
Which code segment should you use?
32. AssignmentUserControl control = new AssignmentUserControl();
LoadControl(userControlPath);
_placeHolder.Controls.Add(control);
AssignmentUserControl control = new AssignmentUserControl();
control.ID = userControlPath;
_placeHolder.Controls.Add(control);
Control control _placeHolder.FindControl(userControlPath);
_placeHolder.Controls.Add(control);
Control control = LoadControl(userControlPath);
_placeHolder.Controls.Add(control);
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-009 Jump to Question ID
Question 13 Explanation:
You should call the LoadControl method of the Page class to load the user control, and
then call the Add method of the _placeHolder instance's Controls collection. The
LoadControl method loads a user control from a file and returns a Control instance that
represents the loaded user control. The Add method of the _placeHolder instance's
Controls collection adds the user control to the _placeHolder instance.
You should not create an instance of AssignmentUserControl and add it to the
_placeHolder instance's Controls collection. To load a user control, you must call the
LoadControl method of the Page class and specify the path to the user control as a
parameter.
You should not call the FindControl method of the _placeHolder instance to load a user
control. The FindControl method returns instances of controls that are already added to
a control's hierarchy.
Objective:
List all
questions
for this
objective</ Consuming and Creating Server
P< td>
Controls
33. Sub-Objective:
2.2 Load user controls dynamically.
References:
1. How to: Create Instances of ASP.NET User Controls Programmatically
Click here for further information
MSDN, Microsoft
Question 14 / 75 Mark for Review
You create a Web application by using 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 need to write code so that the _refreshButton control causes the entire
page to be posted back.
Which code segment should you use?
protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterRequiresRaiseEvent(_refreshButton);
}
protected void Page_Load(object sender, EventArgs e)
{
Page.RegisterRequiresPostBack(_refreshButton);
}
protected void Page_Load(object sender, EventArgs e)
{
34. _scriptManager.RegisterPostBackControl(_refreshButton);
}
protected void Page_Load(object sender, EventArgs e)
{
_scriptManager.RegisterAsyncPostBackControl(_refreshButton);
}
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-018 Jump to Question ID
Question 14 Explanation:
You should call the RegisterPostBackControl method of the ScriptManager class. This
method instructs a control to always cause a full post back instead of an asynchronous
post back. By default, controls that are children of an UpdatePanel control perform
asynchronous post backs if the ChildrenAsTriggers property of the UpdatePanel control
is set to true, which is the default value. To prevent a child control from performing an
asynchronous post back, you must either set ChildrenAsTriggers to false or call the
RegisterPostBackControl method for the child control.
You should not call the RegisterAsynchronousPostBackControl method of the
ScriptManager class. This method instructs a control to always perform an
asynchronous post back.
You should not call the RegisterRequiresPostBack method of the Page class. This
method instructs the page processor to call methods of the IPostBackDataHandler
interface implemented by a control when a page post back occurs. It does not matter
whether the post back is a full post back or an asynchronous post back.
You should not call the RegisterRequiresRaiseEvent method of the Page class. This
method instructs the page processor to call the RaisePostBackEvent method of the
IPostBackEventHandler interface implemented by a control when a page post back
occurs. It does not matter whether the post back is a full post back or an asynchronous
post back.
35. Objective:
List all
questions
for this
objective</ Working with ASP.NET AJAX and
P< td>
Client-Side Scripting
Sub-Objective:
5.1 Implement Web Forms by using ASP.NET AJAX.
References:
1. ScriptManager Enables AJAX In Your Web Apps
Click here for further information
MSDN, Microsoft
2. ScriptManager.RegisterPostBackControl Method
Click here for further information
MSDN, Microsoft
3. ScriptManager.RegisterAsyncPostBackControl Method
Click here for further information
MSDN, Microsoft
Question 15 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. A page in the
application allows users to dynamically configure its layout. By clicking a
Button control on the page, users can dynamically add user controls to the
page. The following code exists for the page:
public partial class PortalPage : System.Web.UI.Page
36. {
private int _sectionCount = 0;
protected void AddButton_Click(object sender, EventArgs e)
{
Control control = this.Load("Section.ascx");
Controls.Add(control);
_sectionCount++;
}
}
You need to ensure that the page retains the dynamically-added user controls
as it undergoes post-back requests. Your solution must not allow a
configuration change to override this functionality.
Which code segments should you use? (Each correct answer presents part of
the solution. Choose three.)
protected override LoadViewState(object savedState)
{
_sectionCount = (int)savedState;
}
protected override object SaveViewState()
{
ViewState["SectionCount"] = _sectionCount;
}
protected override void LoadControlState(object savedState)
{
Pair pair = (Pair)savedState;
base.LoadControlState(pair.First);
_sectionCount = (int)pair.Second;
for (int index = 0; index < _sectionCount; index++)
{
Control control = this.LoadControl("Section.ascx");
Controls.Add(control);
}
}
protected override object SaveControlState()
{
Pair pair = new Pair();
pair.First = base.SaveControlState();
pair.Second = _sectionCount;
return pair;
}
protected override void OnInit(EventArgs e)
{
Page.RegisterRequiresControlState(this);
base.OnInit(e);
}
37. Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-003 Jump to Question ID
Question 15 Explanation:
You should use control state to persist the count of the dynamically-added user
controls. A developer or administrator cannot disable control state for a page through a
configuration change. You should override SaveControlState to save the current count
of dynamically-added user controls. However, you must also save the default control
state of the page. To do this, you should create a Pair instance, which simply allows you
to group two objects together. You should then return the Pair instance from the
method. The instance that you return is passed to the LoadControlState method when
the page loads. This allows you to determine the number of user controls that were
dynamically added during the last page request and recreate those controls. To enable
control state, you must call the RegisterRequiresControlState method of the Page class.
You should call this method from within the OnInit method of the Page class.
You should not override LoadViewState and SaveViewState. These methods give you
greater control over what is stored and retrieved from view state. However, a developer
or administrator can disable view state for the page after the application is deployed
through a configuration change.
Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
Sub-Objective:
7.5 Implement session state, view state, control state, cookies, cache, or application
state.
References:
1. Control State vs. View State Example
Click here for further information
MSDN, Microsoft
38. 2. ASP.NET State Management Overview
Click here for further information
MSDN, Microsoft
3. Page.RequiresControlState Method
Click here for further information
MSDN, Microsoft
Question 16 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. You create a
custom server control named Circle, which exists in the BcdTrain.WebControls
namespace. The control contains a single read-write property named Radius of
type Double. You implement the control as an Asynchronous JavaScript and
XML (AJAX) extender control that allows the Radius property to be set in client
script. You implement the following code in an associated JavaScript file (line
numbers are included for reference only):
01 Type.registerNamespace("BcdTrain.WebControls");
02 BcdTrain.WebControls.Circle = function(elem)
03 {
04 BcdTrain.WebControls.Circle.initializeBase(this, elem);
05 this._radius = 0;
06 }
07 BcdTrain.WebControls.Circle.prototype =
08 {
09 initialize : function()
10 {
11 BcdTrain.WebControls.callBaseMethod(this, 'initialize');
12 },
13 dispose : function()
14 {
15 BcdTrain.WebControls.callBaseMethod(this, 'dispose');
16 },
17
18 }
19 BcdTrain.WebControls.Circle.registerClass('BcdTrain.WebControls.Circle',
Sys.UI.Control);
You need to define the Radius property in the JavaScript file:
Which code segment should you insert at line 17?
39. Radius : function()
{
return this._radius;
}
get_Radius : function()
{
return this._radius;
},
set_Radius : function(value)
{
this._radius = value;
}
Radius : function()
{
return this._radius;
},
Radius : function(value)
{
this._radius = value;
}
Radius : function(value)
{
this._radius = value;
}
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-067 Jump to Question ID
Question 16 Explanation:
You should use the following code segment:
get_Radius : function()
{
return this._radius;
},
set_Radius : function(value)
{
this._radius = value;
}
This code defines two functions named get_Radius and set_Radius. Because JavaScript
does not support the concept of properties, you must implement the Radius property as
40. two distinct functions with different names. The get_Radius function returns the value
of the Radius property. The set_Radius function sets the value of the Radius property.
You should not use the following code segment:
Radius : function()
{
return this._radius;
},
Radius : function(value)
{
this._radius = value;
}
This code defines two functions with the same name. Because JavaScript does not
support the concept of properties, you must implement the Radius property as two
distinct functions with different names.
You should not use the following code segment:
Radius : function()
{
return this._radius;
}
This code defines a single function that returns the value of the Radius property.
However, you should also define a function that sets the value of the Radius property.
You should not use the following code segment:
Radius : function(value)
{
this._radius = value;
}
This code defines a single function that sets the value of the Radius property. However,
you should also define a function that returns the value of the Radius property.
41. Objective:
List all
questions
for this
objective</ Working with ASP.NET AJAX and
P< td>
Client-Side Scripting
Sub-Objective:
5.2 Interact with the ASP.NET AJAX client-side library.
References:
1. Adding ASP.NET AJAX Client Capabilities to a Web Server Control
Click here for further information
MSDN, Microsoft
2. ScriptManager Enables AJAX In Your Web Apps
Click here for further information
MSDN, Microsoft
3. An Introduction to JavaScript Object Notation (JSON) in JavaScript and .NET
Click here for further information
MSDN, Microsoft
4. Creating Custom Client Script by Using the Microsoft AJAX Library
Click here for further information
MSDN, Microsoft
Question 17 / 75 Mark for Review
42. You create a Web application by using Microsoft ASP.NET 3.5. You need to build
the application and deploy it to a remote server. You use virtual private
networking (VPN) to connect to the remote server's network. You are granted
access to the folder where you need to deploy the application. Front Page
Server Extensions are not installed on the remote server.
You need to use Microsoft Visual Studio 2008 to deploy the application. Your
solution must prevent access to source code files used by the application.
What should you do?
Use the Copy Web Site tool and choose the File System option.
Use the Publish Web Site tool and choose the Remote Site option.
Use the Publish Web Site tool and choose the File System option.
Use the Copy Web Site tool and choose the Remote Site option.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-056 Jump to Question ID
Question 17 Explanation:
You should use the Publish Web Site tool and choose the File System option. This allows
you to compile and deploy the application to a local directory, network drive, or file
share.
You should not use the Publish Web Site tool and choose the Remote Site option. This
option requires that the server have Front Page Server Extensions installed.
You should not choose the Copy Web Site tool. This tool copies project files, which
includes source code, to a target location.
Objective:
List all
questions
for this
objective</ Configuring and Deploying Web
P< td>
43. Applications
Sub-Objective:
1.5 Publish Web applications.
References:
1. Walkthrough: Publishing a Web Site
Click here for further information
MSDN, Microsoft
2. Publish Web Site Dialog Box
Click here for further information
MSDN, Microsoft
3. How to: Publish Web Sites (Visual Studio)
Click here for further information
MSDN, Microsoft
Question 18 / 75 Mark for Review
You create a Web site by using Microsoft ASP.NET 3.5. The following code
exists in the App_Code folder:
namespace BcdTrain.Providers
{
public class SessionSiteMapProvider : SiteMapProvider
{
// Members omitted for brevity
}
}
You need to modify the Web.config file to ensure that SiteMapDataSource
controls use the SessionSiteMapProvider class by default.
Which configuration should you use?
44. <siteMap defaultProvider="BcdTrain.Providers.SessionSiteMapProvider">
</siteMap>
<siteMap defaultProvider="SessionSiteMapProvider">
<providers>
<add
name="BcdTrain.Providers.SessionSiteMapProvider"
type="SiteMapProvider"
</providers>
</siteMap>
<siteMap defaultProvider="BcdTrain.Providers.SessionSiteMapProvider,
App_Code">
</siteMap>
<siteMap defaultProvider="SessionSiteMapProvider">
<providers>
<add
name="SessionSiteMapProvider"
type="BcdTrain.Providers.SessionSiteMapProvider, App_Code"
</providers>
</siteMap>
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-034 Jump to Question ID
Question 18 Explanation:
You should use the following configuration:
<siteMap defaultProvider="SessionSiteMapProvider">
<providers>
<add
name="SessionSiteMapProvider"
type="BcdTrain.Providers.SessionSiteMapProvider, App_Code"
</providers>
</siteMap>
This configuration adds a site map provider named SessionSiteMapProvider that maps
to the SessionSiteMapProvider class in the BcdTrain.Providers namespace. The name
attribute specifies a user-friendly name of the provider. The type attribute specifies the
fully-qualified type name of the provider in the form [Namespace].[Class], [Assembly].
App_Code indicates that the assembly is one that is generated for code in the
App_Code folder. This configuration also sets the defaultProvider attribute to
45. SessionSiteMapProvider, which is the name of the provider that is added.
SiteMapDataSource controls that do not specify a value for the SiteMapProvider
property will automatically use the default provider.
You should not use the following configuration:
<siteMap defaultProvider="SessionSiteMapProvider">
<providers>
<add
name="BcdTrain.Providers.SessionSiteMapProvider"
type="SiteMapProvider"
</providers>
</siteMap>
The defaultProvider attribute must match the name of a defined site map provider. Also,
the type attribute must specify the fully-qualified type name of a site map provider.
You should not use the following configuration:
<siteMap defaultProvider="BcdTrain.Providers.SessionSiteMapProvider">
</siteMap>
The defaultProvider attribute must match the name of a defined site map provider. In
this configuration, no additional site map providers are defined.
You should not use the following configuration:
<siteMap defaultProvider="BcdTrain.Providers.SessionSiteMapProvider, App_Code">
</siteMap>
The defaultProvider attribute must match the name of a defined site map provider. In
this configuration, no additional site map providers are defined.
Objective:
List all
questions
for this
objective</ Configuring and Deploying Web
P< td>
Applications
46. Sub-Objective:
1.1 Configure providers.
References:
1. Implementing ASP.NET Site-Map Providers
Click here for further information
MSDN, Microsoft
2. How to: Configure Multiple Site Maps and Site-Map Providers
Click here for further information
MSDN, Microsoft
3. ASP.NET Site Maps
Click here for further information
MSDN, Microsoft
Question 19 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The following
code exists in the application:
public class Account
{
public double Balance { get; set; }
public void Deposit(double amount)
{
Balance += amount;
}
public void Withdraw(double amount)
{
System.Diagnostics.Trace.WriteLineIf(amount > Balance, "Potential
Overdraft.");
if (amount <= Balance)
{
Balance -= amount;
}
47. }
}
This code writes a trace message if there is potential for an overdraft.
You need to configure the Web.config file to write the trace message to the
trace viewer tool (Trace.axd).
Which configurations should you use? (Each correct answer presents part of
the solution. Choose two.)
<trace enabled="true"/>
<system.diagnostics>
<trace>
<listeners>
<add name="WebPageTraceListener"
type="System.Web.WebPageTraceListener,
System.Web,
Version=2.0.3600.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</listeners>
</trace>
</system.diagnostics>
<trace enabled="false" writeToDiagnosticsTrace="true"/>
<trace enabled="false" writeToDiagnosticsTrace="true" pageOutput="false"/>
<system.diagnostics>
<switches>
<add name="PageOutput" value="Trace.axd"/>
</switches>
</system.diagnostics>
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-040 Jump to Question ID
Question 19 Explanation:
You should use the following configuration:
<system.diagnostics>
<trace>
<listeners>
<add name="WebPageTraceListener"
48. type="System.Web.WebPageTraceListener,
System.Web,
Version=2.0.3600.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"/>
</listeners>
</trace>
</system.diagnostics>
This adds a new trace listener to the Listeners collection of the
System.Diagnostics.Trace class. The WebPageTraceListener class is implemented to
write diagnostic trace messages to the ASP.NET tracing subsystem. Whenever you write
a trace message by using the System.Diagnostics.Trace class, that message is also
written to the ASP.NET tracing subsystem. You can view messages written to the
ASP.NET tracing subsystem by accessing Trace.axd in the current Web application.
You should also use the following configuration:
<trace enabled="true"/>
This configuration enables ASP.NET tracing. If you do not enable ASP.NET tracing,
nothing will be written to the ASP.NET tracing subsystem. Note that you must add this
configuration in the <system.web> section.
You should not use the following configuration:
<trace enabled="false" writeToDiagnosticsTrace="true"/>
This configuration disables ASP.NET tracing. The writeToDiagnosticsTrace attribute
specifies whether ASP.NET trace messages should be written to listeners defined for
diagnostic tracing. However, in this scenario, you need to write diagnostic trace
messages to the ASP.NET tracing subsystem.
You should not use the following configuration:
<trace enabled="false" writeToDiagnosticsTrace="true" pageOutput="false"/>
This configuration disables ASP.NET tracing. The writeToDiagnosticsTrace attribute
specifies whether ASP.NET trace messages should be written to listeners defined for
diagnostic tracing. However, in this scenario, you need to write diagnostic trace
messages to the ASP.NET tracing subsystem. The pageOutput attribute specifies
whether ASP.NET trace messages can be viewed by requesting pages in addition to
Trace.axd.
49. You should not use the following configuration:
<system.diagnostics>
<switches>
<add name="PageOutput" value="Trace.axd"/>
</switches>
</system.diagnostics>
This configuration defines a trace switch named PageOutput that is set to the value
Trace.axd. Trace switches allow you to write conditional diagnostic trace messages in an
application based on the value of the switch.
Objective:
List all
questions
for this
objective</ Troubleshooting and Debugging
P< td>
Web Applications
Sub-Objective:
4.4 Implement tracing of a Web application.
References:
1. Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing
Click here for further information
MSDN, Microsoft
2. How to: View ASP.NET Trace Information with the Trace Viewer
Click here for further information
MSDN, Microsoft
3. How to: Enable Tracing for an ASP.NET Application
Click here for further information
MSDN, Microsoft
4. ASP.NET Tracing Overview
50. Click here for further information
MSDN, Microsoft
Question 20 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. A page contains
a DropDownList control named _cultureList. This control displays a list of
languages to which the user interface can be localized. The page uses localized
resources in the App_LocalResources folder.
You need to write code to localize the page based on the selected language.
Your solution must retain the localized version of the page across post-back
requests.
Which code segment should you use?
protected override void OnInit(EventArgs e)
{
string culture = _cultureInfo.SelectedValue;
Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
}
protected override void OnPreRender(EventArgs e)
{
string culture = _cultureInfo.SelectedValue;
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
}
protected override void OnPreInit(EventArgs e)
{
string culture = _cultureInfo.SelectedValue;
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
}
protected override void InitializeCulture()
{
string culture = Request.Form["_cultureList"];
if (culture != null)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
}
}
51. Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-005 Jump to Question ID
Question 20 Explanation:
You should override the InitializeCulture method and set the CurrentUICulture property
of the current Thread instance. The CurrentUICulture property represents the user
interface culture. It specifies the culture that is used to read localized resources. A
DropDownList control saves its selected value in an HTML form field. Because of this,
you can easily determine the current culture by accessing the value of this field. This
allows you to reset the CurrentUICulture property to the current culture across post-
back requests.
You should not set the CurrentUICulture property in the OnInit method. This will
prevent the current culture from being retained across post-back requests.
You should not set the CurrentCulture property. The CurrentCulture property allows you
to specify a culture that is used to display and format numbers, currencies, dates and
times. It does not specify the culture that is used to read localized resources.
Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
Sub-Objective:
7.3 Implement globalization and accessibility.
References:
1. How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization
Click here for further information
MSDN, Microsoft
52. Question 21 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. Your application
must load employee data from an XML file into a DataSet instance. The XML
file contains an inline schema.
You need to call a method of the DataSet class to load the data.
What should you do?
Call the ReadXml method with the ReadSchema XML read mode.
Call the ReadXml method with the InferTypedSchema XML read mode.
Call the ReadXmlSchema method.
Call the ReadXml method with the InferSchema XML read mode.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-062 Jump to Question ID
Question 21 Explanation:
You should call the ReadXml method with the ReadSchema XML read mode. This
method reads data and loads schema information from an inline schema.
You should not call the ReadXml method with the InferSchema XML read mode. This
method loads data and infers the schema from the data. It does not read an inline
schema.
You should not call the ReadXml method with the InferTypedSchema XML read mode.
This method loads data and infers a strongly-typed schema from the data. It does not
read an inline schema.
53. You should not call the ReadXmlSchema method. This method reads schema
information from a schema file or stream. In this scenario, the XML file contains both
the schema and the data.
Objective:
List all
questions
for this
objective</ Working with Data and Services
P< td>
Sub-Objective:
3.2 Manipulate data by using DataSet and DataReader objects.
References:
1. Loading a DataSet from XML
Click here for further information
MSDN, Microsoft
2. XmlReadMode Enumeration
Click here for further information
MSDN, Microsoft
3. DataSet.ReadXml Method (Stream, XmlReadMode)
Click here for further information
MSDN, Microsoft
54. Question 22 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. You are
dynamically loading a user control into a container on a page.
You need to load the control during the correct page event so that the control
participates in post back data processing and validation.
What should you do?
Handle the PreRender event and load the user control.
Handle the Init event and load the user control.
Handle the Load event and load the user control.
Handle the SaveStateComplete event and load the user control.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-041 Jump to Question ID
Question 22 Explanation:
You should handle the Init event and load the user control. This event is raised after a
control is initialized. For a dynamically added user control to participate in post back
data processing and validation, you must load the control during the Init event.
You should not handle the Load event and load the user control. This event is raised
after the Init event, indicating that a control is loaded. For a dynamically added user
control to participate in post back data processing and validation, you must load the
control during the Init event.
You should not handle the PreRender event and load the user control. This event is
raised just before the control is rendered. For a dynamically added user control to
55. participate in post back data processing and validation, you must load the control
during the Init event.
You should not handle the SaveStateComplete event and load the user control. This
event is raised after the PreRender event and after the control's view state and control
state are saved. For a dynamically added user control to participate in post back data
processing and validation, you must load the control during the Init event.
Objective:
List all
questions
for this
objective</ Consuming and Creating Server
P< td>
Controls
Sub-Objective:
2.2 Load user controls dynamically.
References:
1. TemplateControl.LoadControl Method (String)
Click here for further information
MSDN, Microsoft
2. An Extensive Examination of User Controls
Click here for further information
MSDN, Microsoft
Question 23 / 75 Mark for Review
56. You create a Web application by using Microsoft ASP.NET 3.5. You write the
following code to create a template control:
[ParseChildren(true)]
public class EmployeeViewer : Control, INamingContainer
{
public Employee Employee {get; set; }
[TemplateContainer(typeof(EmployeeTemplateContainer))]
public ITemplate EmployeeTemplate {get; set; }
protected override void CreateChildControls()
{
}
}
public class EmployeeTemplateContainer : Control, INamingContainer
{
public Employee Employee {get; set; }
}
You need to implement the CreateChildControls method of the
EmployeeViewer class so that content specified in the EmployeeTemplate
property is rendered by the EmployeeViewer control.
Which code segment should you use?
if (this.EmployeeTemplate == null)
{
this.Controls.Clear();
EmployeeTemplateContainer container = new EmployeeTemplateContainer()
{
Employee = this.Employee;
};
this.Controls.Add(container);
}
if (this.EmployeeTemplate == null)
{
this.Controls.Clear();
EmployeeTemplateContainer container = new EmployeeTemplateContainer()
{
Employee = this.Employee;
};
this.EmployeeTemplate.InstantiateIn(container);
this.Controls.Add(container);
}
if (this.EmployeeTemplate != null)
{
this.Controls.Clear();
EmployeeTemplateContainer container = new EmployeeTemplateContainer()
{
Employee = this.Employee;
};
this.Controls.Add(container);
57. }
if (this.EmployeeTemplate != null)
{
this.Controls.Clear();
EmployeeTemplateContainer container = new
EmployeeTemplateContainer()
{
Employee = this.Employee;
};
this.EmployeeTemplate.InstantiateIn(container);
this.Controls.Add(container);
}
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-010 Jump to Question ID
Question 23 Explanation:
You should first determine whether the EmployeeTemplate property of the
EmployeeViewer class returns a null reference. If it does not, this means that you
should render its contents. To do this, you must first create an instance of the
template's container, which is EmployeeTemplateContainer. A template container allows
you to store all of the template's content into a single container control. This allows you
to render the content by simply adding the container to the templated control's
hierarchy. To place the template into the container, you should call the InstantiateIn
method of EmployeeTemplate, passing to the method an instance of the container into
which the template will be placed. This causes all markup between the
<EmployeeTemplate> and </EmployeeTemplate> tags to be placed into the
EmployeeTemplateContainer instance. You should then add the
EmployeeTemplateContainer instance to the EmployeeViewer control's hierarchy.
You should not instantiate the template into its container if the EmployeeTemplate
property returns a null reference. A null reference indicates that there is no template
content to place in the container.
You should not add the template container to the EmployeeViewer control's hierarchy
without first instantiating the template into its container. Otherwise, the markup
specified between the <EmployeeTemplate> and <EmployeeTemplate> tags will not get
rendered.
58. Objective:
List all
questions
for this
objective</ Consuming and Creating Server
P< td>
Controls
Sub-Objective:
2.3 Create and consume custom controls.
References:
1. Developing a Templated Control
Click here for further information
MSDN, Microsoft
2. Building Templated Custom ASP.NET Server Controls
Click here for further information
MSDN, Microsoft
Question 24 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. Your application
displays order information from an XML file that does not contain an inline
schema. A DataSet-compatible schema is stored in an XSD file. The schema
defines a subset of the nodes that exist in the XML file. This schema should not
be modified.
You need to load the XML data so that it can be navigated relationally and with
the XML Document Object Model (DOM).
What should you do?
59. Load the XML file into a DataSet instance.
Create an XmlDataDocument instance from the DataSet instance.
Load the XSD file into a DataSet instance.
Load the XML file into the DataSet instance by using the InferSchema read mode.
Create an XmlDataDocument instance from the DataSet instance.
Load the XSD file into a DataSet instance.
Create an XmlDataDocument instance from the DataSet instance.
Load the XML file into the XmlDataDocument instance.
Load the XSD file and XML file into a DataSet instance.
Create an XmlDataDocument instance from the DataSet instance.
Load the XML file into the XmlDataDocument instance.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-061 Jump to Question ID
Question 24 Explanation:
You should synchronize a DataSet instance with an XmlDataDocument instance. The
DataSet class allows you to expose XML data relationally. The XmlDataDocument class
allows you to navigate data relationally and with the XML DOM. You should first load the
XSD file into a DataSet instance. This defines the schema for the DataSet instance. You
should then call the XmlDataDocument constructor, passing to it the DataSet instance
that should be synchronized. Finally, you should load the XML data into the
XmlDataDocument instance. This allows the entire XML data to be navigated, while
allowing only the nodes defined in the XSD schema to be navigated relationally in the
DataSet instance.
Although you should load the XSD file into the DataSet instance, you should not load
the XML file into the DataSet instance by using the InferSchema read mode. This
causes additional schema definitions to be inferred from the XML data and added to the
existing schema.
You should not load the XML file into an XmlDataDocument instance that is
synchronized with a DataSet instance that already contains data. This would throw an
exception.
You should not load the XML file without first loading the XSD file into the DataSet
instance. This would cause the DataSet instance to infer the schema from the XML file.
60. Objective:
List all
questions
for this
objective</ Working with Data and Services
P< td>
Sub-Objective:
3.1 Read and write XML data.
References:
1. Synchronizing a DataSet with an XmlDataDocument
Click here for further information
MSDN, Microsoft
2. Loading a DataSet from XML
Click here for further information
MSDN, Microsoft
3. DataSet and XmlDataDocument Synchronization (ADO.NET)
Click here for further information
MSDN, Microsoft
4. XML Integration with Relational Data and ADO.NET
Click here for further information
MSDN, Microsoft
Question 25 / 75 Mark for Review
61. You create a Web application by using Microsoft ASP.NET 3.5. The following
code exists in the code-behind file for a page named Admin.aspx:
[WebMethod]
public static string GetSessionObject(string key)
{
return HttpContext.Current.Session[key] as string;
}
You need to call the GetSessionObject method from JavaScript, passing to it
the value of a TextBox control named _sessionKey. You must display the return
value in a browser alert window.
You need to modify the page to accomplish your goal.
What should you do? (Each correct answer presents part of the solution.
Choose two.)
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>
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>
Declare a ScriptManager control on the page as follows:
<ScriptManager ID="_scriptManager" runat="server"
EnablePageMethods="true"/>
Declare a ScriptManager control on the page as follows:
<ScriptManager ID="_scriptManager" runat="server">
<Services>
<asp:ServiceReference Path="Admin.aspx"/>
</Services>
</ScriptManager>
Add the following script block to the page:
<script language="javascript" type="text/javascript">
function GetSessionObject()
{
var sessionKey = $get('_sessionKey').value;
62. var result = PageMethods.GetSessionObject(sessionKey);
window.alert(result);
}
</script>
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-024 Jump to Question ID
Question 25 Explanation:
You should declare a ScriptManager control on the page as follows:
<ScriptManager ID="_scriptManager" runat="server" EnablePageMethods="true"/>
The EnablePageMethods property specifies whether page methods are enabled for the
page. Page methods are public static methods that have the WebMethod attribute
applied. These methods can be called from JavaScript through AJAX requests. Setting
the EnablePageMethods property to true allows page methods to be called as Web
methods from a script on that page as if they were part of a Web service, but you do
not have to create a separate .asmx file.
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>
This script calls the GetSessionObject function of the PageMethods Asynchronous
JavaScript and XML (AJAX) object. This function internally makes an AJAX request to
the server to invoke the corresponding GetSessionObject methods. When the
EnablePageMethods property of the ScriptManager class is set to true, ASP.NET AJAX
automatically generates functions that have the same names as the page methods
63. defined for the page. The first parameters to a function match the parameters to the
corresponding page method. In addition, the function defines another parameter that
specifies a callback function to invoke when the AJAX request completes. The parameter
to the callback function is the return value from the page method.
You should not declare a ScriptManager control on the page as follows:
<ScriptManager ID="_scriptManager" runat="server">
<Services>
<asp:ServiceReference Path="Admin.aspx"/>
</Services>
</ScriptManager>
This declaration attempts to reference a Web service that can be called by AJAX
requests. In this scenario, Admin.aspx does not implement a Web service.
You should not 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>
This script does not specify the callback function in the call to
PageMethods.GetSessionObject. The call will return immediately because it is
asynchronous. You must specify the callback function to retrieve the return value from
the page method.
You should not 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>
64. This script attempts to call the GetSessionObject function of an Admin object. However,
to call page methods, you must call functions of the PageMethods object.
Objective:
List all
questions
for this
objective</ Working with ASP.NET AJAX and
P< td>
Client-Side Scripting
Sub-Objective:
5.1 Implement Web Forms by using ASP.NET AJAX.
References:
1. Exposing Web Services to Client Script
Click here for further information
MSDN, Microsoft
2. Calling Web Services from Client Script
Click here for further information
MSDN, Microsoft
3. ScriptManager.EnablePageMethods Property
Click here for further information
MSDN, Microsoft
Question 26 / 75 Mark for Review
65. You create a Web site by using Microsoft ASP.NET 3.5. You define a custom
configuration section in the Web.config file. You obtain the source file
containing the implementation of the configuration section.
You need to configure the application so that the configuration section is
processed by ASP.NET.
What should you do?
Add a Reference directive to the Global.asax file and set the VirtualPath attribute
to the location of the source file.
Add the source file to the App_Code folder.
Add a Register directive to the Global.asax file and set the Src attribute to the
location of the source file.
Add the source file to the project as an embedded resource.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-073 Jump to Question ID
Question 26 Explanation:
You should add the file to the App_Code folder of the project. The App_Code folder
allows you to store utility classes for use in a Web site project. Code placed in this
folder is dynamically compiled into an assembly. This allows ASP.NET to process the
custom configuration section when it processes the Web.config file.
You should not add the source file to the project as an embedded resource. Embedded
resources are not compiled. You must compile the source file so that ASP.NET can
process the custom configuration section.
You should not add a Reference directive to the Global.asax file. This directive instructs
ASP.NET to dynamically compile a referenced page or user control when the requesting
page is compiled. This allows you to programmatically interact with the referenced page
or user control from the file in which the directive exists. Reference directives are not
supported in the Global.asax file.
You should not add a Register directive to the Global.asax file. This directive allows you
to register server controls and user controls on a page. Register directives are not
supported in the Global.asax file.
66. Objective:
List all
questions
for this
objective</ Programming Web Applications
P< td>
Sub-Objective:
7.4 Implement business objects and utility classes.
References:
1. Shared Code Folders in ASP.NET Web Sites
Click here for further information
MSDN, Microsoft
Question 27 / 75 Mark for Review
You create a Web application by using Microsoft ASP.NET 3.5. The application
is part of a solution that contains a Windows Communication Foundation
(WCF) service project. The Web application must make calls to a service
defined in the WCF service project. You plan to host the Web application on a
separate server from the WCF service. The WCF service must execute
remotely.
You need to add a reference to the WCF service.
What should you do?
Add an assembly reference to the project.
Add a project reference to the project.
Add a Web reference to the project.
67. Add a service reference to the project.
Microsoft (70-562) TS: Microsoft .NET Framework 3.5 - ASP.NET Application
Development (C#) (Preview)
Question ID: jehMS_70-562CS-068 Jump to Question ID
Question 27 Explanation:
You should add a service reference to the project. This allows you to create a proxy
class for a WCF service. When you make calls to methods defined in the proxy class,
messages are sent to the remote service for invocation.
You should not add a Web reference to the project. A Web reference allows you to
create proxy classes for Extensible Markup Language (XML) Web services. In this
scenario, you need to create a proxy class for a WCF service.
You should not add a project reference to the project. Although project references allow
you to reference assemblies from projects that are defined in the same solution, this
would cause your application to execute the WCF service code locally.
You should not add an assembly reference to the project. Although assembly references
allow you to execute code defined in other assemblies, this would cause your
application to execute the WCF service code locally.
Objective:
List all
questions
for this
objective</ Working with Data and Services
P< td>
Sub-Objective:
3.3 Call a Windows Communication Foundation (WCF) service or a Web service from an
ASP.NET Web page.
References: