Disable caching using [OutputCache] attribute fails

1k Views Asked by At

what would the situations be for this attribute to fail?

[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]

It is working on one of my Action but for some reason, It didn't work for this specific ActionResult function:

[HttpPost, ValidateAntiForgeryToken]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")]
public ActionResult EntryDetailsCreate(EntryItemVm vm)
{
    if (ModelState.IsValid)
    {
       EntryItem = vm.ToNew();
       string error = e.IsValid();

       if (string.IsNullOrWhiteSpace(error))
       {
           _EntryService.Append(e);
           _EntryService.Commit(User.Identity.Name);

            return RedirectToAction("EntryDetails", new { entryNo = e.EntryNo });
        }

        ModelState.AddModelError("", error);
    }

    // there is something wrong
    return View(vm);
}

The problem is when I press the back button in my browser, the data is still there and when you press save, it will create a new entry again.

0

There are 0 best solutions below