Asp – Cache Asp.net Mvc Home Page

asp.net-mvccaching

I am having an issue with caching the home page of my Asp.Net Mvc App.

All the other pages cache fine using the [OutputCache(Duration=60, VaryByParam="None")] action filter.

The problem is that the home page does not cache. I noticed that if I access the home page via Controller/Action ("Home/Index") then it caches but when accessed via "/" it doesn't work.

Any ideas?

Best Answer

What version of asp.net-mvc are you using? If it's the latest release then you might need to create a new project and copy the Page_Load method from "Default.aspx" which is different in later versions and has a slight change which i think handles caching of "/"....