Set Output Cache in c# MVC 4

458
Views
1
Answers

Hi ,
How do I set Output cache in MVC4?

edit | flag
Mad Maddy
Asked on: Feb 11, 2012 at 3:34AM

1 Answers

128
1
128

Just decorate your action with Outputcache attribute

[HandleError]
public class HomeController : Controller
{
   
[OutputCache(Duration=500, VaryByParam="*")]
   
public ActionResult Index()
   
{
       
ViewBag.Title = "Home Page" + DateTime.Now;

       
return View();
   
}
}
edit | flag
Gokul A
Answered on: Feb 11, 2012 at 3:36AM

Post your Answer

Search

Welcome to Ask Amoeba!
This is 100% free and interactive site for sharing professional Questions and Answers, Opensource projects, Interview questions.
Learners, beginners, Experts stop and share your knowledge and ideas!

Browse Categories

Browse Tags