Disable unused ViewEngines, Application_Start() in global.asax:

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());

Never send null to a strongly typed view, instead send an empty model:

public ActionResult Insert(){
    return View(new SomeModel());
}

Cache actions that don’t need live data.

Cache for 10 seconds, on server(same cached content for all users):

[OutputCache(Duration=10, VaryByParam="none")]
public ActionResult SemiStaticPage()
{
    return View();
}

Cache for 30 seconds, on client(individually cached content), tell proxys not to store a copy:

 [OutputCache(Duration=30, VaryByParam="none", Location=OutputCacheLocation.Client, NoStore=true)]
public ActionResult SemiStaticPage()
{
    return View();
}

Cache for 1hour, on server, one cached entry per passed parameter value:

[OutputCache(Duration=3600, VaryByParam="Id")]
public ActionResult SemiStaticPage(Id)
{
    return View();
}
 

Seems to work :)

 
namespace NevYn.se.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
© 2011 NevYn.se Suffusion theme by Sayontan Sinha