ASP.NET MVC OutputCache doesn't work for root URI

I'm learning ASP.NET MVC and bugged by one issue.

In the HomeController, the Index action has OutputCache attribute, but it seems doesn't work.

public class HomeController : Controller
    [OutputCache(Duration=5, VaryByParam="none")]
    public ActionResult Index()
        ViewData["Title"] = "Home Page" + DateTime.Now;
        ViewData["Message"] = "Welcome to ASP.NET MVC! " + DateTime.Now;

        return View();

After quite a few minutes trying, I found that it is due to the way I access the action. If I access it through "http://localhost:3573/", the outputcache doesn't work. However, if I access it with "http://localhost:3575/Home/Index", the outputcache works.

Anybody know any workaround to make the default controller-action outputcacheable?



I think this is a bug in ASP.NET MVC. We have logged the issue in our database and will investigate a fix for this issue.

Thanks, Eilon

Need Your Help

Non-proprietary directory encryption

encryption directory compression

We store measurement results in directories. Each directory has a meta.xml which describes common things about the result file, and several files of data. This result has to be encrypted.

How to implement customized stack view in android?

android android-layout customization android-view stackview

I have searched the internet but I couldn't find some good explanation or advice.