Question:You are developing an ASP.Net MVC 2 view and controller. The controller includes an action method that retrieves rows from a Product table in Microsoft SQL Server database. You need to cache the data that the action method returns. What should you do? 

A Add the following <outputCacheSettings> section to the web.config file. <system.web> <caching> <outputCacheSettings> <outputCacheProfiles> <add name="ProductView" duration="60" varyByParam="*"/> </outputCacheProfiles> </outputCacheSettings> </caching> </system.web>  

B Add the following line of code to the controller. Cache.insert("key", "ProductView", null, DateTime.Now.AddMinutes(60),TimeSpan.Zero);  

C Add the following attribute to the action method [OutputCache(Duration=60)];  

D Add the following directive to the top of the view <%@ OutPutCache Duration="60" VaryByParam="*" %>  

+ Answer
+ Report
Total Preview: 1180

Copyright © 2024. Powered by Intellect Software Ltd