Monday, November 22, 2010

MVC response caching

An MVC response can be cached on client side using [OutputCache].
e.g.
public class UserController : Controller
{
[OutputCache(Duration = 60, VaryByParam = "None")] // Duration in seconds
public ActionResult List()
{
try
{
UserCache objUsers = new UserCache();
return View(objUsers.GetUsersList());
}
catch (Exception ex)
{
throw ex;
}
}
}

No comments:

Post a Comment