Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RedirectToAction not working at all

In the AccountController, in the end of a method I have:

RedirectToAction("EveryView", "Account");

In the same controller file I have this method:

public ActionResult EveryView()
    {
        return View();
    }

But this method never gets called. I have a breakpoint on '{' and it never gets hit!

like image 561
petko_stankoski Avatar asked Jan 10 '12 15:01

petko_stankoski


People also ask

What is difference between redirect and RedirectToAction?

RedirectToAction is meant for doing 302 redirects within your application and gives you an easier way to work with your route table. Redirect is meant for doing 302 redirects to everything else, specifically external URLs, but you can still redirect within your application, you just have to construct the URLs yourself.

How pass multiple parameters in RedirectToAction in MVC?

Second, to pass multiple parameters that the controller method expects, create a new instance of RouteValueDictionary and set the name/value pairs to pass to the method. Finally call RedirectToAction(), specifying the method name, controller name, and route values dictionary.


1 Answers

you have put 'return' else it won't redirect.

return RedirectToAction("EveryView", "Account");

like image 71
Bonanza Avatar answered Sep 24 '22 17:09

Bonanza