0

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.

arvstracthoughts
  • 730
  • 1
  • 7
  • 24
  • Pressing back on your browser will most likely cause the browser to reload that page from its own cache so will not even try to hit your action method. – DavidG Jun 14 '14 at 03:15
  • 1
    Hi @DavidG, as you can see on the attribute there is this "NoStore = true, Duration = 0" which means there must be absolutely "NO" caching involved that's why it will hit the action method. The problem is in some of my action method decorated by this attribute also, when I push the back button it a "Confirm Form Resubmission" is appearing but in this method it doesn't have that. – arvstracthoughts Jun 14 '14 at 03:27
  • so is it possible that when you press the back button, the old data must not be there? – arvstracthoughts Jun 14 '14 at 03:49
  • http://stackoverflow.com/questions/2628183/how-to-handle-form-submission-asp-net-mvc-back-button/30964024#30964024 – Yovav Jun 22 '15 at 04:57

0 Answers0