Question 1 You are troubleshooting an ASP.NET Web application.

System administrators have recently expanded your web farm from one to two servers. Users are periodically reporting an error message about invalid view state. You need to fix the problem. What should you do? A. Set viewStateEncryptionMode to Auto in web.config on both servers. B. Set the machineKey in machine.config to the same value on both servers. C. Change the session state mode to SQLServer on both servers and ensure both servers us the e same connection string. D. Override the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.

Question: 2
You create an ASP.NET page named TestPage.aspx that contains validation controls. You need to verify that all input values submitted by the user have been validated by testing the Page.IsValid property. Which page event should you add an event handler to? A. Init B. Load C. PreInit D. PreLoad

Question 3 You are implementing an ASP.NET application that includes a page named TestPage.aspx. TestPage.aspx uses a master page named TestMaster.master. You add the following code to the TestPage.aspx code-behind file to read a TestMaster.master public property named CityName. protected void Page_Load(object sender, EventArgs e) { string s = Master.CityName; } You need to ensure that TestPage.aspx can access the CityName property. What should you do? A. Add the following directive to TestPage.aspx. <%@ MasterTypeVirtualPath="~/TestMaster.master" %> B. Add the following directive to TestPage.aspx. <%@ PreviousPageTypeVirtualPath="~/TestMaster.master" %> C. Set the Strict attribute in the @ Master directive of the TestMaster.master page to true. D. Set the Explicit attribute in the @ Master directive of the TestMaster.master page to true.

Q4 You are implementing an ASP.NET Web site that will be accessed by an international audience. The site contains global and local resources for display elements that must be translated into the language that is selected by the user. You need to ensure that the Label control named

lblCompanydisplays text in the users selected language from the global resource file. Which control markup should you use? A. <asp:Label ID="lblCompany" runat="server" meta:resourcekey="lblCompany" /> B. <asp:Label ID="lblCompany" runat="server" Text="meta:lblCompany.Text" /> C. <asp:Label ID="lblCompany" runat="server" Text="<%$ Resources:lblCompanyText %>" /> D. <asp:Label ID="lblCompany" runat="server" Text="<%$ Resources:WebResources, lblCompanyText %>" />

Q5 You are developing an ASP.NET Web application. You create a master page. The master page requires a region where you can add page-specific content by using the ASP.NET page designer. You need to add a control to the master page to define the region. Which control should you add? A. Content B. ContentPlaceHolder C. PlaceHolder D. Substitution

Q6 You are implementing an ASP.NET application that uses data-bound GridView controls in multiple pages. You add JavaScript code to periodically update specific types of data items in these GridView controls. You need to ensure that the JavaScript code can locate the HTML elements created for each row in these GridView controls, without needing to be changed if the controls are moved from one page to another. What should you do? A. Replace the GridView control with a ListView control. B. Set the ClientIDMode attribute to Predictable in the web.config file. C. Set the ClientIDRowSuffix attribute of each unique GridView control to a different value. D. Set the @ OutputCache directives VaryByControl attribute to the ID of the GridView control.

Q7 You have created an ASP.NET server control named ShoppingCart for use by other developers. Some developers report that the ShoppingCart control does not function properly with ViewState disa bled. You want to ensure that all instances of the ShoppingCart control work even if ViewState is disabled. What should you do? A. Require developers to set EnableViewStateMac to true. B. Store state in ControlState instead of ViewState. C. Serialize the state into an Application state entry called "MyControl". D. Require developers to change the session state mode to SQLServer.

Q8 You are developing an ASP.NET Web application. Application data is stored in a Microsoft SQL Server 2008 database. You configure a connection string named cnnContosoThe application must cache the data that is returned from the database by using this connection string. You need to ensure that the application checks the database every 10 seconds. What should you do? A. Add the following configuration to the <system.web> section of the web.config file. <caching> <outputCacheSettings> <outputCacheProfiles> <add name="cnnContoso" duration="10" /> </outputCacheProfiles> </outputCacheSettings> </caching> B. Add the following configuration to the <system.web> section of the web.config file. <caching> <sqlCacheDependency enabled="true" pollTime="10000"> <databases> <add name="ContosoDatabase" connectionStringName="cnnContoso" /> </databases> </sqlCacheDependency> </caching> C. Add the following @ Page directive to pages that query the database. <%@ OutputCache Duration="10" VaryByParam="cnnContoso" %> D. Add the following @ Page directive to pages that query the database. <%@ OutputCache Duration="10000" VaryByParam="cnnContoso" %>

Q9 You are developing an ASP.NET Web page that contains input controls, validation controls, and a button named btnSubmit. The page has the following code-behind. (Line numbers are included for reference only.) 01 public partial class _Default :System.Web.UI.Page 02 { 03 protected void SaveToDatabase() 04 { 05 06 }

SaveToDatabase().SaveToDatabase(). if (Page. EventArgs e) { } } .NET Web site.SaveToDatabase(). Add the following method override. } protected void Page_Load(object sender. protected override void OnLoad(EventArgs e) { base. Add the following method override. The site has a master page named Custom. protected override void OnPreRender(EventArgs e) { base. Q10 You are creating an ASP.master.IsValid) this.OnInit(e).master contains the following code segment. set. Add the following method override. } C.OnLoad(e). } D.IsValid) this. if (Page. protected override void OnInit(EventArgs e) { base.OnPreRender(e).07 08 protected void btnSubmit_Click(object sender. Add the following code segment at line 10.IsValid) this. The codebehind file for Custom. if (Page. } B.IsValid) this.SaveToDatabase(). if (Page. public partial class CustomMaster : MasterPage { public string Region { get. EventArgs e) 09 { 10 11 } 12 } You need to ensure that all data that is submitted passes validation before the data is saved in a database. What should you do? A.

CustomMaster custom = this. Q11 You create a Web page that contains the following code.Region.master as its master page. CustomMaster custom = this.Parent as CustomMaster.Text = this.style.You create a new ASP.Text = custom. D.Text = custom. Add the following code segment to the Page_Load method of the page code -behind file.cs code-behind file. (Line numbers are included for reference only. What should you do? A.Region. lblRegion. C.Region. Add the following code segment to the Page_Load method of the Custom.Master as CustomMaster.Text = this.FindControl("lblRegion") as Label. lblRegion. You need to display the value of the master pages Region property in lblRegion. 04 } 05 </script> 06 .getElementById("message"). lblRegion.FindControl("lblRegion") as Label.cs code-behind file. Add the following code segment to the Page_Load method of the Custom. You add a Label control named lblRegion to the new page. Label lblRegion = Master.Master.color=c. lblRegion.NET page and specify Custom.Master. B.) 01 <script> 02 function changeColor(c) { 03 document.Region. Add the following code segment to the Page_Load method of the page code-behind file. Label lblRegion = Page.

07 <p id="message">Welcome!</p> 08 <ul id="color"> 09 <li>Black</li> 10 <li>Red</li> 11 </ul> You need to ensure that when the user clicks an item in the list.">Black</a></li> </ul> D.style. Which declaration should you use? A.innerText).innerText).">Black</li> <li onclick="changeColor(this.">Red</a></li> <li><a onfocus="changeColor(this.">Black</li> <li onclick="changeColor(this.color).color).style. <ul id="color"> <li onclick="changeColor(this.innerText).style. <ul id="color"> <li onclick="changeColor(this.style. the text color of the Welcome! message will change.">Red</li> </ul> C.color).">Red</a></li> <li><a onfocus="changeColor(this. <ul id="color"> <li><a onfocus="changeColor(this.color).innerText). <ul id="color"> <li><a onfocus="changeColor(this.">Black</a></li> </ul> .">Red</li> </ul> B.

"> <div><a href ="#">Item Three</a></div> <div><a href ="#">Item Four</a></div> </div> </div> You need to write a JavaScript function that will enable the drop-down menus to activate when the user positions the mouse over the menu title. <div class="dropdown-menu"> <div class="menu-title">Menu One</div> <div class="menu-items" style=" display:none .Q12 You create a Web page that contains drop-down menus that are defined by using div tags in the following code."> <div><a href ="#">Item One</a></div> <div><a href ="#">Item Two</a></div> </div> </div> <div class="dropdown-menu"> <div class="menu-title">Menu Two</div> <div class="menu-items" style=" display:none . Which code segment should you use? .

}.hover( function () { $(this.hover( function () { $(". ".menu-title").menu-items"). }.menu-items". }.slideDown (100).slideDown (100). $(". C. B. } ).hover( function () { $(".menu-items".dropdown-menu").hover( function () { $(this).dropdown-menu"). $(". D. function () { $(".slideUp (100).slideUp (100). function () { $(this.slideUp (100). . } ).A.dropdown-menu"). $(". function () { $(this).dropdown-menu"). } ). $(". }. } ). this).menu-title"). function () { $(".menu-items"). this).slideDown (100).slideDown (100).slideUp (100). ".

What should you set the ClientIDMode property of the DropDownList to? A. What should you do? . You need to ensure that the content of each div element can be refreshed individually. Q14 You are developing an ASP.url ){ $("#target") += $("<img />"). You need to write a JavaScript function that will insert images from the URLs into target. url ). }). }). Predictable Q15 You are implementing an ASP. attr (" src ". function( i.append("#target"). $( imageurls ). <div id="target"> </div> You have a JavaScript array named imageurls that contains a list of image URLs.each(imageurls . B. C.url ){ $("<img />".append("<img />"). You add a data-bound GridView control. attr (" src ". and you set the ClientIDRowSuffix property to ProductID.each(function( i. $. Static C. AutoID B.NET AJAX page that contains two div elements.Q13 You create a Web page that contains the following div. }). }).url ){ $("<img />").each(function( i. url ). src = url .each(imageurls . The GridView contains a TemplateField that includes a DropDownList. You need to be able to reference individual DropDownList controls from client-side script by using the ProductID. You set the GridViewsClientIDMode property to Static.url ){ $("#target").NET Web page. $. without requiring a page refresh. url ). function( i. Inherit D. Which code segment should you use? A. appendTo ("#target"). D. $( imageurls ).

png" /> You need to write a JavaScript function that will dynamically change which image is displayed. t D. and move each div element into a content template.src = "image2. } C.A. Q16 You create a Web page that contains the following image element. and move a div element into each conten template. and a script manager to the page. } D.getElementById("myImage"). Add a script manager and an update panel to each form. } .png". Add a form and two update panels to the page. Add a content template to the update panel. Add two script managers to the form. C. Add two forms to the page. an update panel. function changeImage() { getElementById("myImage"). function changeImage() { document. } B. <img id="myImage" src="/image1. Which code segment should you use? A. B. The function must be compatible across different browsers. one for each update panel. function changeImage() { window. Add a content template to each update panel.png".getElementById("myImage").src = "image2.src = "image2.png". and move each div element into a content template. Add a form. Add a content template to each update panel. Add a content template to each update panel.src = "image2. Add a script manager to the form.png". Add a form and two update panels to the page. function changeImage() { myImage. Move the div elements into the content template.

text(). success: function(xml) { $(xml).text.each(function() { var id = $(this). } . vartx = $(this).attr("value". id) . $. C. $("<option>"). item) { $("<option>").Q17 A Web service returns a list of system users in the following format. Which code segment should you use? A.appendTo("#dropdown").text(tx).find("name"). id) . url: serviceURL. } }). url: serviceURL. in the order provided by the service.ajax({ type: "GET".text(tx).attr("id").ajax({ type: "GET". }).text(tx). }).attr("value".ajax({ type: "GET".attr("value".appendTo("#dropdown"). $.com</email> </user> <user id="second"> <name>Name of second user</name> <email>second @contoso.name. $("<option>"). function(i. } }). id) .find("user").each(function() { var id = $(this).com</email> </user> </users> You need to populate a drop-down menu with the IDs and names of the users from the Web service. B.0" ?> <users> <user id="first"> <name>Name of first user</name> <email>first@contoso. }). success: function(xml) { $. <?xml version="1.find("user"). $. vartx = $(this).each($(xml).id. url: serviceURL.appendTo("#dropdown"). success: function(xml) { $(xml).

. You add two UpdatePanel controls named pnlA and pnlB.attr("id"). url: serviceURL.text(). D. Update panels pnlA and pnlB must refresh their content only when controls that they contain cause a postback. $. and add AsyncPostBackTrigger elements to its Triggers element for every control in pnlB. B. Q18 You are implementing an ASP. Set the UpdateMode of pnlA and pnlB to Conditional. You have the following requirements.find("name"). Update panel pnlAInner must refresh its content when controls in either pnlA or pnlB or pnlAInner cause a postback. Set the UpdateMode of pnlAInner to Always. What should you do? A. D. Set the UpdateMode of pnlAInner to Conditional. id) . Set the UpdateMode of pnlA and pnlB to Always. pnlA contains an UpdatePanel control named pnlAInner in its content template. }).text(tx).appendTo("#dropdown").attr("value". You need to configure the panels to meet the requirements. and add AsyncPostBackTrigger elements to its Triggers element for every control in pnlA.each(function(node) { var id = $(node).ajax({ type: "GET".NET AJAX page.}). C. success: function(xml) { xml. Set the UpdateMode of pnlA and pnlB to Always. vartx = $(node). } }). Set the UpdateMode of pnlAInner to Conditional.find("user"). Set the UpdateMode of pnlA and pnlB to Conditional. $("<option>"). Set the UpdateMode of pnlAInner to Always.

NET Web page. Which control markup should you use? A. <asp:TextBox ID="txt1" runat="server" /> <asp:RegularExpressionValidator ID="val1" EnableClientScript="true" ControlToValidate="txt1" ValidationExpression="[0-9]*" ErrorMessage="Invalid input value" /> . inclusive.Q19 You are implementing an ASP.) A. } </script> B. } </script> C.IsValid = (args. <script type="text/javascript"> functionvalidate_value(obj. <asp:TextBox ID="txt1" runat="server" onChange="validate_value(this.Which two code segments should you us (Each e? correct answer presents part of the solution. <asp:TextBox ID="txt1" runat="server" CausesValidation="true" ValidationGroup="Numeric" /> B. args) { args. <asp:TextBox ID="txt1" runat="server" EnableClientScript="true" ValidationGroup="Numeric" /> C.Value<= 10). Choose two. You need to validate values that are typed by users to ensure that only numeric values are submitted. args)" /> Q20 You are implementing an ASP.Value>= 1 &&args. You need to add a text box that allows only values between 1 and 10. <script type="text/javascript"> functionvalidate_value(obj. <asp:TextBox ID="txt1" runat="server" /> <asp:CustomValidator ID="val1" runat="server" ControlToValidate="txt1" ClientValidationFunction="validate_value" ErrorMessage="Value invalid" /> D. args) { return (args.Value>= 1 &&args.NET page that includes a text box. to be submitted. <asp:TextBox ID="txt1" runat="server" /> <asp:RegularExpressionValidator ID="val1" runat="server" ControlToValidate="txt1" ValidationExpression="[0-9]*" ErrorMessage="Invalid input value" /> D.Value<= 10).

<asp:GridView ID="gvModels" runat="server" onrowdatabound="gvModels_RowDataBound" AutoGenerateColumns="false"> <Columns> <asp:BoundFieldDataField="Name" HeaderText="Model" /> <asp:TemplateField> <ItemTemplate> <asp:Image ID="img" runat="server" /> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> The pages code-behind file includes the following code segment. (Line numbers are included for reference only.NET Web page.) 01 protected void gvModels_RowDataBound(object sender.Q21 You are developing an ASP. The page contains the following markup . .

Format("images/{0}.FirstName %> B. (Line numbers are included for reference only.FirstName)). You need to display the value that is submitted. cm. B.FindControl("img").Row. D. %> D. Image img = (Image)Page. <%: Model. and you must ensure that your code avoids cross-site scripting. Which code segment should you add at line 06? A.Write(HttpUtility. You add the following markup to the page . <% Response. EventArgs e) . Image img = (Image)Page.NET Web page. 06 07 img.FindControl("img").GridViewRowEventArgs e) 02 { 03 if (e. 08 09 } 10 } You need to get a reference to the Image named img.Row.NET MVC 2 application.Write(Model. <%= Model. <asp:FileUpload id="FileUpload1" runat="server" /> <asp:Button id="btnUpload" Text="Upload selected file" OnClick="btnUpload_Click" runat="server" /> <asp:Label id="lblFeedback" runat="server" /> You add the following code segment to the code-behind. %> Q23 You are developing an ASP. <% Response.ID). Q22 You are developing an ASP. Image img = (Image)gvModels.DataRow) 04 { 05 CarModel cm = (CarModel)e.Row.HtmlDecode( Model.FindControl("img").FindControl("img").ImageUrl = String. C.RowType == DataControlRowType.DataItem.) 01 protected void btnUpload_Click(object sender. Image img = (Image)e.Form. A view contains a form that allows users to submit their first name.FirstName %> C.jpg". Which code segment should you use? A.FirstName).

FileName). 06 07 lblFeedback. You need to reject files larger than 1 MB. B.FileContent. What should you do? A. Q24 You are implementing a Web page that allows users to upload files to a Web server.HasFile) B. Replace line 03 with the following code segment. FileUpload1. Add an onSubmit handler to the form to check the file size and cancel the form submission if the file size is too large.Text = "File successfully uploaded. Add an ASP. FileUpload1.FileContent. C. .SaveAs(saveName). Add a server-side OnDataBinding handler that saves the file only if the file size is allowed.Open)). FileUpload1.Text = "File upload failed. D.) A. Add an HTML input type= file control. Add an ASP. Add an HTML input type= file control.NET FileUpload control and configure it to run on the server. Choose two.Length > 0) C. 08 } 09 else 10 { 11 lblFeedback.NET FileUpload control and configure it to run on the server. FileMode. Insert the following code segment at line 06. if (FileUpload1. The page includes a form that has a Submit button. Insert the following code segment at line 06.Combine(@"c:\uploadedfiles\". if (FileUpload1. Add an onChange handler to the input control to check the file size and cancel the upload if the file size is too large.". Replace line 03 with the following code segment. Add a server-side OnClick handler to the forms Submit button to save the file only if the file size is allowed. 12 } 13 } You need to save the uploaded file and display a message to the user that indicates that the upload either succeeded or failed.". D.02 { 03 if () 04 { 05 string saveName = Path. Which two actions should you perform? (Each correct answer presents part of the solution.CopyTo(new FileStream(saveName.

You also must add code to TestPage. EventArgs e) { string s = testControl. } } B. EventArgs e) { string s = testControl. Add the following line of code to the TestUserControl. Y ou need to add an event of type MyEventHandler named MyEvent to TestUserControl.ascx.ascx as shown in the following line of code. } D. Add the following code segment to the TestPage. public delegate void MyEventHandler().aspx to read this value.cs code-behind file.Attributes["CityName"]. protected void Page_Load(object sender.CityName.cs code-behind file. C.ascx.aspx.) .) A.ascx and attach the pages TestMethod method to the event. Which two actions should you perform? (Each correct answer presents part of the solution. private void TestMethod() { } You define the following delegate. } Q26 You use the following declaration to add a Web user control named TestUserControl.NET page named TestPage. you need to add a read-only member named CityName to return the value "New York". <uc:TestUserControl ID="testControl" runat="server"/> On TestUserControl. Add the following line of code to the TestUserControl.ascx. <uc:TestUserControl ID="testControl" runat="server"/> You add the following code to the code-behind file of TestPage. Choose two.aspx uses TestUserControl.aspx and a user control named TestUserControl.aspx. Add the following code segment to the TestPage. protectedreadonly string CityName = "New York" .aspx.cs code-behind file. TestPage.aspx.cs code-behind file.ascx.ascx to an ASP. public string CityName { get { return "New York" .Q25 You create a Web page named TestPage. two. protected void Page_Load(object sender. Which two actions should you perform? (Each correct answer presents part of the solution Choose .

ascx reference in TestPage. NET MVC 2 Web application. publicActionResult I nfo () { return View().cs. Right-click the Views folder. } B.aspx with the following declaration. <uc:TestUserControl ID="testControl" runat="server" MyEvent="TestMethod"/> Q29 You are implementing an ASP. and select Add View to create a view for the action. D. Replace the TestUserControl. public event MyEventHandlerMyEvent.) A. Add the following line of code to TestUserControl. } C. Add the following method to the CompanyController class.ascx. Add the following line of code to TestUserControl. publicActionResultCompany_Info () { return View(). <uc:TestUserControl ID="testControl" runat="server" OnMyEvent="TestMethod"/> D.ascx reference in TestPage. Which two actions should you perform? (Each correct answer presents part of the solution.cs. and select View from the Add submenu to create the view for the action. B. Replace the TestUserControl. You add a controller named CompanyController. Choose two.ascx. C.A. You need to modify the application to handle the URL path /company/info.aspx with the following declaration. . Add the following method to the CompanyController class. publicMyEventHandlerMyEvent. Right-click inside the action method in the CompanyController class.

ID==id)).You need to write a code segment that will call the ListEmployees action method and output the results in place. <%= Html. You want the view to also include a listing of department employees. public class DepartmentController : Controller { static List<Department> departments = new List<Department>().Find(x => x. "DepartmentController") %> C. return View(employees).DisplayForModel("ListEmployees") %> .Q30 You are implementing an ASP.Action("ListEmployees". %> D. } } You create a strongly typed view that displays details for a Department instance.RenderPartial("ListEmployees". <% Html.NET MVC 2 Web application that contains the following class.ActionLink("ListEmployees". publicActionResult Index() { return View(departments). <%= Html. } publicActionResult Details(int id) { return View(departments. <%= Html. Model) %> B. Which code segment should you use? A. Model). } publicActionResultListEmployees(Department d) { List<Employee> employees = GetEmployees(d). "Department".

"Contoso"] You need to write an action method that returns the response in the correct format. ["Adventure Works".Q31 You are developing an ASP. XDocument C. JsonResult D.NET MVC 2 Web application. DataContractJsonSerializer . AjaxHelper B. A page makes an AJAX request and expects a list of company names in the following format. Which type should you return from the action method? A.

public class Player { public String Name { get. Rename Score. The Views/Shared/DisplayTemplates folder contains a templated helper named Score.ascx that performs custom formatting of integer values. What should you do? A. } publicintLastScore { get. set. [Display(Name="LastScore". Add the following attribute to the LastScore property.Q32 You are implementing an ASP. C. } publicintHighScore { get.ascx from the Views/Shared/DisplayTemplates folder to the Views/Player/DisplayTemplates folder. Add the following attribute to the LastScore property.DisplayForModel method is called for any view in the application that has a model of type Player. [UIHint("Score")] D. ShortName="Score")] .NET MVC 2 Web application that contains several folders.ascx. set. set.ascx to LastScore. B. } } You need to ensure that the custom formatting is applied to LastScore values when the HtmlHelper. Move Score. The Models folder contains a class named Player with the following definition.

B. id = "" }). (Line numbers are included for reference only.MapRoute("product_default". controller = "Product". context. AreaRegistration. action = "Index". You need to ensure that the correct page is returned. You then add a file named Route.MapRoute("product_default".cs to the Product folder that contains the following code.RegisterAllAreas().MapRoute("product_default". "product/{controller}/{action}/{id}". you add a subfolder named Product to create a single project area. "{area}". 11 } 12 } When you load the URL http://<applicationname>/product. Replace line 10 with the following code segment. What should you do? A.NET MVC 2 application.cs file. context. you discover that the correct page is not returned. C. new {area="product".RegisterAllAreas().Q33 You are implementing an ASP. AreaRegistration. You add files named ProductController. Add the following code segment to the RegisterRoutes method in the Global. id = "" }). new { controller = "Product". "{area}/{controller}/{action}/{id}". D. . action = "Index". } 06 } 07 08 public override void RegisterArea( AreaRegistrationContext context) 09 { 10 context. Add the following code segment at line 11. action = "Index". new { controller = "Product". Replace line 10 with the following code segment. id = "" }).aspx to the appropriate subfolders.asax. In the Areas folder.cs and Index.) 01 public class Routes :AreaRegistration 02 { 03 public override string AreaName 04 { 05 get { return "product".

ActionLink("Home". "Index".ActionLink("Home". Html. Html. null) D. "Index".ActionLink("Home". Which ActionLink should you use? A.NET MVC 2 Web application.ActionLink("Home". "Home") B. new {area = "Blog"}. null) C. "Home". null) . The application also contains a separate area named Blog. Html.Q34 You are developing an ASP. The application contains a controller named HomeController. new {area = ""}. A view within the Blog area must contain an ActionLink that will link to the Index action of the HomeController. "Home". "Index". Html. You need to ensure that the ActionLink in the Blog area links to the Index action of the HomeController. "Home". new {area = "Home"}. which has an action named Index. "Index".

Add the following configuration to the web.aspx").Transfer("~/Error.Redirect("~/Error. voidApplication_Error(object sender. Add the following code segment to the Global.Q35 You are implementing an ASP.web> <customErrors mode="On"> <error statusCode="500" redirect="~/Error. You also must ensure that the original URL in the browser is not changed.web> C. <system.aspx.NET Web site.asax file. Add the following code segment to the Global.aspx" /> </customErrors> </system. What should you do? A. EventArgs e) { Response.aspx page if an unhandled error occurs on any page within the site. You need to display the Error. } . <system.web> <customErrorsredirectMode="ResponseRewrite" mode="On" defaultRedirect="~/Error. EventArgs e) { Server.config file.aspx"). The root directory of the site contains a page named Error.aspx" /> </system.config file.asax file. Add the following configuration to the web. voidPage_Error(object sender. } D.web> B.

the XCOPY command-line tool B. will deploy to the remote server. the Copy Web Site tool C. You need to choose a deployment method that will ensure that all IIS settings. the Publish Web Site utility .NET Web application to a remote server. the Web Deployment tool D. in addition to the Web content. Which deployment method should you choose? A.Q36 You are deploying an ASP.

NET Web Application template to create an application in a new Visual Studio solution. Modify the Web application project to add a reference to the class library project. Add a post-build step to the Web application project that copies the most recent version of the class library assembly to the bin folder of the Web application. You need to ensure that classes in the Web application project always reference the most recent version of the class library types.config file. add an <assembly /> entry that specifies the location of the class library assembly. Source code for the class library is frequently modified.Q37 You use the ASP. Modify the class library project to add a reference to the Web application project. . C. In the <compilation /> section of the web. What should you do? A. Add a post-build step to the class library project that copies the most recent version of the class library assembly to the App_Code folder of the Web application. The project uses types that are defined in a class library project. B. D. Add the class library project to the solution. Add the class library project to the solution.

The application will generate an ID for the user based on the users full name. Create an ASP. . D. Users will authenticate to the application with an ID. Create an ASP.NET page that contains a custom form that collects the user information and then uses the Membership. Configure the SqlMembershipProvider in the web. B.config file. Configure the SqlProfileProvider in the web.config file. The application will allow new users to register for an account. Which two actions should you perform? (Each correct answer presents part of the solution.NET Web application.) A. C. Choose two.Q38 You are implementing an ASP.CreateUser method to create a new user account. You need to implement this registration functionality.NET page that contains a default CreateUserWizard control to create a new user account.

IsInRole("Administrators").Any(). Q40 You are creating an ASP.NET Web site.EndRequest += new EventHandler(app_EndRequest).Response. public void Init(HttpApplication app) { app. specify the address of the target service. specify the address of the router service.Identity.EndRequest += new EventHandler(app_EndRequest).NET Web application. "Administrators"). In the client binding configuration. The site is configured to use Membership and Role management providers. } voidapp_EndRequest(object sender. app. You need to ensure that the application can invoke the target service by using the router endpoint. B. public CustomModule(HttpApplication app) { app.GetRolesForUser("Administrators"). EventArgs e) { HttpApplication app = sender as HttpApplication. The application must call a WCF service by using a WCF routing service. specify the address of the router service. specify the address of the target service. In the client binding configuration.config file.Q39 You are creating an ASP. Add a service reference to the router service. You need to check whether the currently logged-on user is a member of a role named Administrators. You create a HTTP module named CustomModule.Any().NET Web site. bool isMember = User. D. } B. D. } . B. bool isMember = Membership.ValidateUser(User. Add a service reference to the target service.Name. Add a service reference to the router service. C. Which code segment should you use? A. and you register the module in the web.GetUsersInRole("Administrators"). Q41 You are creating an ASP. The CustomModule class contains the following code.Write(footerContent). public class CustomModule : IHttpModule { stringfooterContent = "<div>Footer Content</div>". Which code segment should you use? A. What should you do? A.NET page. bool isMember = Roles. public void Dispose( ) {} } You need to add code to CustomModule to append the footer content to each processed ASP. C. In the client binding configuration. Add a service reference to the target service. bool isMember = Roles. In the client binding configuration.

public void Init(HttpApplication app) { app. Run the aspnet_regiis.Response.Write(footerContent).EndRequest += new EventHandler(app_EndRequest). EventArgs e) { HttpApplication app = sender as HttpApplication.Write(footerContent).exe command. app.config file.Write(footerContent). C. EventArgs e) { HttpApplication app = new HttpApplication().EndRequest += new EventHandler(app_EndRequest). } Q 42 You deploy an ASP.Response. } voidapp_EndRequest(object sender. app. Add the following rule to the healthMonitoring section of the web.Response. <rules> <add name="Failures" eventName="Failure Audits" provider="EventLogProvider" /> </rules> D.config file. public CustomModule() { HttpApplication app = new HttpApplication().NET application to an IIS server. Set the Treat warnings as errors option to All in the project properties and recompile. app. You need to log health-monitoring events with severity level of error to the Windows application event log. EventArgs e) { HttpApplication app = sender as HttpApplication. } D.voidapp_EndRequest(object sender. B. Add the following rule to the healthMonitoring section of the web. What should you do? A. } voidapp_EndRequest(object sender. app. <rules> <add name="Errors" eventName="All Errors" provider="EventLogProvider" /> </rules> . } C.

Construct C. protected void Page_Load(object sender. <asp:QueryStringParameterDefaultValue="pid" Name="productId" Type="Int32" /> B. You add and configure the following ObjectDataSource. } D.Add("productId".NET Dynamic Data Web application. protected void odc_Selecting(object sender. OnLoad B. Add the following code segment to the pages code-behind.QueryString["p i d"]).QueryString["p roductId "]. Add the following event handler to the Selecting event of the ObjectDataSource control. You replace the markup in the default Boolean field template with the following markup. You need to configure the ObjectDataSource control to pass the value of the pid field to GetProductsByProductId method. <asp:QueryStringParameterQueryStringField="pid" Name="productId" Type="Int32" /> C. ObjectDataSourceSelectingEventArgs e) { e. Boolean fields must display as Yes or No instead of as a check box. What should you do? A. Replace the asp:Parameter with the following declaration. <asp:Labelrunat="server" ID="label" /> You need to implement the code that displays Yes or No.Q43 You are developing an ASP. } . Request. OnDataBinding D.InputParameters["p id "] = Request. EventArgs e) { odc. Which method of the FieldTemplateUserControl class should you override in the BooleanField class? A. Replace the asp:Parameter with the following declaration. <asp:ObjectDataSourceSelectMethod="GetProductByProductId" ID="odc" runat="server" TypeName="ProductDAL"> <SelectParameters> <asp:Parameter Name="productId" Type="Int32" /> </SelectParameters> </asp:ObjectDataSource> The page will be called with a query string field named pid.SelectParameters. SaveControlState Q44 You are implementing an ASP.NET page.

C.Name)). B. Which code segment should you use? A. Client-side script requires data.SelectMany( p =>p.Select(p =>p.Serialize(names). You need to use the JavaScriptSerializer class to serialize only the value of the Name property of each item in the people list. Your application includes a class named Person with a Name property of type string. IEnumerator<T> D. var names = from person in people select person.Serialize(names) + "}". Q46 You are developing an ASP. IComparer<T> B. public string JsonValue. You need to create an extension method to compute the median value.Q45 You are implementing an ASP. IEnumerable<T> C.Name.Serialize(people. JsonValue = json.AsEnumerable())).NET Web page that will display the median value from a sequence of integer values. var names = from person in people select person. JavaScriptSerializerjson = new JavaScriptSerializer().NET page. JsonValue = json. The code-behind file of the page includes the following code segment. JsonValue = json. D.Serialize(people. IEqualityComparer<T> . JsonValue = "{" + json. Which interface should you add the extension method to? A. List<Person> people = GetPeopleList().

C.aspx") { Action = PageAction. ViewName = "ListDetails".Web.List. routes. public static void RegisterRoutes(RouteCollection routes) { { routes.QueryableFilterUserControl.aspx") { Action = PageAction. In the code-behind file for the control.Details.ascx to the Dynamic Data\Filters folder of the Web site. B.asax. What should you do? A.cs file contains the following code segment. Add a new Web user control named Products.EntityTemplateUserControl.Web.Add(new DynamicDataRoute("{table}/ListDetails. The Global. Add a new Web user control named Products_ListDetails. D.NET Dynamic Data Web site. The Web site includes a data context that enables automatic scaffolding for all tables in the data model. In the code-behind file for the control. You add a new code file that contains the following code segment. } public partial class RateService : IRateService { public decimal GetCurrentRate() { .Add(new DynamicDataRoute("{table}/ListDetails. Model = DefaultModel }).DynamicData. Q48 You are implementing a WCF service library.DynamicData. change the base class from UserControl to System.aspx to the Products folder.Q 47 You are implementing an ASP. Add a new Web page named Products. Model = DefaultModel }).aspx to the Dynamic Data\PageTemplates folder of the Web site.ascx to the Dynamic Data\EntityTemplates folder of the Web site. change the base class from UserControl to System. Add a new folder named Products to the Dynamic Data\CustomPages folder of the Web site. namespaceContosoWCF { [ServiceContract] public interface IRateService { [OperationContract] decimalGetCurrentRate(). ViewName = "ListDetails". Add a new Web page named ListDetails. } You need to display the items in a table named Products by using a custom layout.

Apply the ScriptService attribute to the RateService class.RateService" Factory="System.ServiceModel. What should you do? A. dtlView.svc to the IIS application. Apply the WebGet attribute to the GetCurrentRate interface method. Q49 You are implementing an ASP. Rebuild the WCF service library.DataBind(). .NET page. Add a file named Service.Activation. B. Rebuild the WCF service library. dtlView.decimalcurrentRate = GetRateFromDatabase().WebScriptServiceHostFactory" %> C.DataSource = new DataTable("dataSet".ServiceModel.DataSource = GetCustomerOrderDataSet(). dtlView. dtlView.DataSourceID = "OrderDetailsTable". D. The DataSet includes a DataTable named CustomerDetailsTable and a DataTable named OrderDetailsTable. and redeploy the assembly to the IIS application. dtlView. Which code segment should you use? A. <%@ ServiceHost Service="ContosoWCF. dtlView.DataBind(). You need to display the data in OrderDetailsTable in a DetailsView control named dtlView.DataKeyNames = new string [] { "OrderDetailsTable"}.Activation.DataBind(). Add the following code segment to the file.DataSource = GetCustomerOrderDataSet(). "OrderDetailsTable"). <%@ ServiceHost Service="ContosoWCF. The page includes a method named GetCustomerOrderDataSet that returns a DataSet. dtlView.IRateService" Factory="System.DataBind(). Add the following code segment to the file. and redeploy the assembly to the IIS application. DataSetdataSet = GetCustomerOrderDataSet(). Add a file named Service.DataMember = "OrderDetailsTable". dtlView.svc to the IIS application. dtlView. C.WebScriptServiceHostFactory" %> B. dtlView. You need to ensure that the GetCurrentRate method can be called from JavaScript. D. dtlView. } } } You build the service library and deploy its assembly to an IIS application. returncurrentRate.DataSource = GetCustomerOrderDataSet().

NET Web service.BasicProfile1_1)] 02 public class ProductService : System.Services.) .) 01 [WebServiceBinding(ConformsTo = WsiProfiles.Q50 You are developing an ASP.WebService 03 { 04 [WebMethod] 05 public Product GetProduct(string name) 06 { 07 08 } 09 10 [WebMethod] 11 public Product GetProduct(int id) 12 { 13 14 } 15 } You need to ensure that both GetProduct methods can be called from a Web client. (Line numbers are included for reference only. The following code segment implements the service. Choose two. Which two actions should you perform? (Each correct answer presents part of the solution.Web.

[SoapDocumentMethod(Action="GetProductById")] D. [WebMethod(MessageName="GetProductById")] . Modify the attribute on line 10 as follows. Add the following attribute before line 10. B. C. Remove line 01. Add the static modifier on lines 05 and 11.A.

DataMember . Which FormView property should you set in the code-behind file? A. You need to bind the list to the FormView control. The page includes a List<Product> instance. DataSource B. You add a FormView control to display a single Product from this list.Q 51 You are developing an ASP. DataSourceID C.NET Web page. DataKeyNames D.