单选题You are developing an ASP.NET MVC 2 application. A view contains a form that allows users to submit their first name. You need to display the value that is submitted, and you must ensure that your code avoids cross-site scripting. Which code segment should you use?()A%: Model.FirstName %B%= Model.FirstName % C% Response.Write(Model.FirstName) % D% Response.Write(HttpUtility.HtmlDecode(Model.FirstName)) %
单选题
You are developing an ASP.NET MVC 2 application. A view contains a form that allows users to submit their first name. You need to display the value that is submitted, and you must ensure that your code avoids cross-site scripting. Which code segment should you use?()
A
<%: Model.FirstName %>
B
<%= Model.FirstName %>
C
<% Response.Write(Model.FirstName) %>
D
<% Response.Write(HttpUtility.HtmlDecode(Model.FirstName)) %>
参考解析
解析:
暂无解析
相关考题:
()developing the market in your area, we are airmailing you new models of our products. A、With a view toB、Due toC、Owing toD、In order to
You create a Microsoft ASP.NET Web application by using the Microsoft .NET Framework version 3.5. When you review the application performance counters, you discover that there is an unexpected increase in the value of the Application Restarts counter. You need to identify the reasons for this increase. What are three possible reasons that could cause this increase?()A、Restart of the Microsoft IIS 6.0 host. B、Restart of the Microsoft Windows Server 2003 that hosts the Web application. C、Addition of a new assembly in the Bin directory of the application. D、Addition of a code segment that requires recompilation to the ASP.NET Web application. E、Enabling of HTTP compression in the Microsoft IIS 6.0 manager for the application. F、Modification to the Web.config file in the system.web section for debugging the application.
You are implementing an ASP.NET MVC 2 Web application that allows users to view and edit data. You need to ensure that only logged-in users can access the Edit action of the controller. What are two possible attributes that you can add to the Edit action to achieve this goal? ()A、[Authorize(Users = "")]B、[Authorize(Roles = "")]C、[Authorize(Users = "*")]D、[Authorize(Roles = "*")]
You are developing an ASP.NET application by using Visual Studio 2010. You need to interactively debug the entire application. Which two actions should you perform? ()A、Set the Debug attribute of the compilation node of the web.config file to true.B、Add a DebuggerDisplay attribute to the code-behind file of the page that you want to debug.C、Select the ASP.NET debugger option in the project properties.D、Define the DEBUG constant in the project settings.
You have a Microsoft ASP.NET Framework version 1.0 application. The application does not use any features that are deprecated in the Microsoft .NET Framework version 3.5. The application runs on Microsoft IIS 6.0. You need to configure the application to use the ASP.NET Framework version 3.5 without recompiling the application. What should you do?()A、Edit the ASP.NET runtime version in IIS 6.0. B、Edit the System.Web section handler version number in the machine.config file. C、Add the requiredRuntime configuration element to the Web.config file and set the version attribute to v3.5. D、Add the supportedRuntime configuration element in the Web.config file and set the version attribute to v3.5.
You are implementing an ASP. NET MVC 2 Web application. You add a controller named Company Controller. You need to modify the application to handle the URL path /company/info. Which two actions should you perform?()A、Add the following method to the CompanyController class. Function Info() As ActionResult Return View() End FunctionB、Add the following method to the CompanyController class. Function Company_Info() As ActionResult Return View() End FunctionC、Right-click the Views folder, and select View from the Add submenu to create the view for the action.D、Right-click inside the action method in the CompanyController class, and select Add View to create a view for the action
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、ContentB、ContentPlaceHolderC、PlaceHolderD、Substitution
You are developing an ASP.NET Web application. The application must pass an object that contains user-specific data between multiple pages. The object ismore than 100 KB in size when serialized.You need to minimize the amount of data is sent to the user. What should you do?()A、Pass the object data in a hidden field.B、Store the object instance in a session variable.C、Use a cookie that contains the object data.D、Encode the object data and pass it in a query string parameter.
You are developing an ASP.NET Web page that will display the median value from a sequence of integer values. You need to create an extension method to compute the median value. Which interface should you add the extension method to?()A、 IComparerTB、 IEnumerableTC、 IEnumeratorT D、 IEqualityComparerT
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 theASP.NET page designer. You need to add a control to the master page to define the region. Which control should you add?()A、PlaceHolderB、ContentPlaceHolderC、ContentD、Substituition
You are developing a Windows Presentation Foundation (WPF) application. You need to use XAML to create a custom control that contains two Button controls. From which base class should you inherit? ()A、FrameworkElementB、UIElementC、UserControlD、Button
You are implementing an ASP.NET MVC 2 Web application. The URL with path /Home/Details/{country} will return a page that provides information about the named country. You need to ensure that requests for this URL that contain an unrecognized country value will not be processed by the Details action of HomeController. What should you do?()A、Add the ValidateAntiForgeryToken attribute to the Details action method.B、Add the Bind attribute to the country parameter of the Details action method. Set the attribute’s Prefix property to Country.C、Create a class that implements the IRouteConstraint interface. Configure the default route to use this class.D、Create a class that implements the IRouteHandler interface. Configure the default route to use this class.
You are implementing an ASP.NET MVC 2 Web application that contains the following class. Public Class DepartmentControllerInherits Controller Shared departments As List(Of Department) = New List(Of Department) Function Index() As ActionResultReturn View(departments)End Function Function Details(ByVal id As Integer) As ActionResultReturn View(departments.Find(Function(x) x.ID = id))End Function Function ListEmployees(ByVal d As Department) As ActionResultDim employees As List(Of Employee) = GetEmployees(d)Return View (employees)End FunctionEnd Class You create a strongly typed view that displays details for a Department instance. You want the view to also include a listing of department employees. You need to write a code segment that will call the ListEmployees action method and output the results in place. Which code segment should you use?()A、%= Html.Action("ListEmployees", Model) % B、%= Html.ActionLink("ListEmployees", "Department", "DepartmentController") % C、% Html.RenderPartial("ListEmployees", Model) %D、%= Html.DisplayForModel("ListEmployees") %
单选题You are developing an ASP.NET MVC 2 application. A view contains a form that allows users to submit their first name. You need to display the value that is submitted, and you must ensure that your code avoids cross-site scripting. Which code segment should you use?()A%: Model.FirstName %B%= Model.FirstName % C% Response.Write(Model.FirstName) % D% Response.Write(HttpUtility.HtmlDecode(Model.FirstName)) %
单选题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?()ASet viewStateEncryptionMode to Auto in web.config on both servers.BSet the machineKey in machine.config to the same value on both servers.CChange the session state mode to SQLServer on both servers and ensure both servers use the same connection string.DOverride the SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium methods in the page base class to serialize the view state to a local web server file.
多选题You are implementing an ASP.NET MVC 2 Web application that allows users to view and edit data. You need to ensure that only logged-in users can access the Edit action of the controller. What are two possible attributes that you can add to the Edit action to achieve this goal? ()A[Authorize(Users = )]B[Authorize(Roles = )]C[Authorize(Users = *)]D[Authorize(Roles = *)]
单选题You are developing an ASP.NET MVC 2 Web application. The application contains a controller named HomeController, which has an action named Index. The application also contains a separate area named Blog. A view within the Blog area must contain an ActionLink that will link to the Index action of the HomeController. You need to ensure that the ActionLink in the Blog area links to the Index action of the HomeController. Which ActionLink should you use?()AHtml.ActionLink(Home, Index, Home)BHtml.ActionLink(Home, Index, Home, new {area = }, null)CHtml.ActionLink(Home, Index, Home, new {area = Blog}, null)DHtml.ActionLink(Home, Index, Home, new {area = Home}, null)
单选题You are developing an ASP.NET MVC 2 Web application. The application contains a controller named Home Controller, which has an action named Index. The application also contains a separate area named Blog. A view within the Blog area must contain an Action Link that will link to the Index action of the Home Controller. You need to ensure that the Action Link in the Blog area links to the Index action of the HomeController. Which Action Link should you use?()AHtml.ActionLink(Home, Index, Home)BHtml.ActionLink(Home, Index, Home, New With {.area = }, Nothing)CHtml.ActionLink(Home, Index, Home, New With {.area = Blog}, Nothing)DHtml.ActionLink(Home, Index, Home, New With {.area = Home}, Nothing)
单选题ou are developing an ASP.NET MVC 2 application. You create a view that will be returned by action methods in multiple controllers. You need to place the view in the appropriate folder. To which subfolder within the Views folder should you add the view?()AMasterBDefaultCSharedDCommon
单选题You are developing an ASP.NET Web page that will display the median value from a sequence of integer values. You need to create an extension method to compute the median value. Which interface should you add the extension method to?()A IComparerTB IEnumerableTC IEnumeratorT D IEqualityComparerT
单选题You manage a server that runs Windows Server 2008. The server has the Web Server (IIS) role installed. The Web developer at your company creates a new Web site that runs an ASP.NET 3.0 Web application. The ASP.NET Web application must run under a security context that is separate from any other ASP.NET application on the Web server. You create a local user account and grant account rights and permissions to run the ASP.NET Web application. You need to configure authentication for the new Web site to support the Web application. What should you do?()AConfigure the Windows Authentication setting to Enabled.BConfigure the Forms Authentication setting to Enabled by using all the default settings.CConfigure the ASP.NET State service to log on to the new local user account by using the Services console.DConfigure the ASP.NET Impersonation setting to Enabled. Edit the ASP.NET Impersonation setting by specifying the new local user account.
单选题You modify an existing Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5. You add a theme to the ASP.NET application. You need to apply the theme to override any settings of individual controls. What should you do?()AIn the Web.config file of the application,set the Theme attribute of the pages element to the name of the theme.BIn the Web.config file of the application,set the StyleSheetThemeattribute of the pages element to the name of the theme.CAdd a master page to the application. In the @Master directive,set the Theme attribute to the name of the theme.DAdd a master page to the application. In the @Master directive,set the StyleSheetTheme attribute to the name of the theme.
单选题You are developing an ASP.NET Dynamic Data Web application. Boolean fields must display as Yes or No instead of as a check box. You replace the markup in the default Boolean field template with the following markup.You need to implement the code that displays Yes or No. Which method of the FieldTemplateUserControl class should you override in the BooleanField class?()AOnLoadBConstructCOnDataBindingDSaveControlState
单选题You work as an ASP.NET Web Application Developer for SomeCompany. The company uses Visual Studio .NET 2010 as its application development platform. You create an ASP.NET MVC 2 Web application using .NET Framework 4.0. You implement a single project area in the MVC 2 Web application. In the Areas folder, you add a subfolder named MyTest. You add the following files to the appropriate sub-folders: MyController. csMyHome.aspx You register a route of the area, setting the route name to MyTest_default and the area name to test. You create a view named MyViews.aspx that is outside the test area. You need to add a link to MyViews.aspx that points to MyHome.aspx. Which of the following code segments will you use?()A%= Html.ActionLink(MyTest, MyHome, new {area = test}, null)%B%= Html.RouteLink(MyHome, MyTest, new {area = test}, null)% C%= Html.RouteLink(MyTest, MyHome, MyTest, new {area = test}, null)%D%= Html.ActionLink(MyTest, MyHome, MyTest, new {area = test}, null)%
单选题You are developing an ASP.NET MVC 2 Web application. A page makes an AJAX request and expects a list of company names in the following format. ["Adventure Works","Contoso"] You need to write an action method that returns the response in the correct format. Which type should you return from the action method?()AAjaxHelperBXDocumentCJsonResultDDataContractJsonSerializer
单选题You are implementing an ASP.NET MVC 2 Web application that contains the following class. Public Class DepartmentControllerInherits Controller Shared departments As List(Of Department) = New List(Of Department) Function Index() As ActionResultReturn View(departments)End Function Function Details(ByVal id As Integer) As ActionResultReturn View(departments.Find(Function(x) x.ID = id))End Function Function ListEmployees(ByVal d As Department) As ActionResultDim employees As List(Of Employee) = GetEmployees(d)Return View (employees)End FunctionEnd Class You create a strongly typed view that displays details for a Department instance. You want the view to also include a listing of department employees. You need to write a code segment that will call the ListEmployees action method and output the results in place. Which code segment should you use?()A%= Html.Action(ListEmployees, Model) % B%= Html.ActionLink(ListEmployees, Department, DepartmentController) % C% Html.RenderPartial(ListEmployees, Model) %D%= Html.DisplayForModel(ListEmployees) %
单选题You are developing a report to allow customers in a department store to view product information. You added a button to the layout to allow customers to view the picture of the product. Which button property would you alter to specify the source of the .BMP file?()AType BMultimedia file CMulti media file type DLabel type