RedirectToAction does not refresh the page as expected

What am I doing wrong with the MVC code here? An Index view includes a form that represents to myself that I would like the controller to process the submitted form and then return to the view.

Actually the form is processed correctly, but the returned view looks as if nothing is happening (for example, identifiers that have been deleted are still displayed). If I refresh the page manually, it displays correctly again. I don’t think that this is due to broswer caching, since redirecting to the same view from another controller works fine. How can i fix this?

    public ViewResult Index()
    {
        return View(GetComments());
    }


    [HttpPost]
    public ActionResult Index(int[] AllIds)
    {
        if (AllIds != null)
        {
            foreach (int id in AllIds)
            {
               // do stuff
            }
        }

        return RedirectToAction("Index");
    }

: " (F11)". return RedirectToAction("Index"); }.

+5
3

Fiddler Firebug Firefox , , HTTP 304 ( ). , db / .

+4

? , , , , .?

public ViewResult Index()
{ // breakpoint
    var comments = GetComments(); // debug and inspect the value of this variable
    return View(comments);
}


[HttpPost]
public ActionResult Index(int[] AllIds)
{
    if (AllIds != null)
    {
        foreach (int id in AllIds)
        {
           // do stuff
        }
    }

    return RedirectToAction("Index"); // breakpoint
} 

, IUnitOfWork MVC, SaveChanges/Commit ORM . , //do stuff , db , GET Index()?

RedirectToAction("Index") RedirectToAction(Index())?

+1

Try entering a controller name. It helps me. For instance:

return RedirectToAction("Index","Home");
0
source

All Articles