Can Response.Redirect work in a private void MVC 2 Function?

Posted by user54197 on Stack Overflow See other posts from Stack Overflow or by user54197
Published on 2010-05-13T12:55:00Z Indexed on 2010/05/13 13:04 UTC
Read the original article Hit count: 319

Filed under:
|
|

I have a private void function set for some validation. Should my validation fail, I would like to redirect to another ActionResult and kill the process for the ActionResult that was being used. Response.Redirect("controllerName") does not help. Any ideas?

[Accept(HttpVerbs.Post)]
public ActionResult NerdDinner(string Name)
{
   testName(Name);
   ...
   Return RedirectToAction("ActionResultAAA");
}

private void testName(string name)
{
    if(name == null)
    {
        //Response.Redirect("ActionResultBBB");
    }
}

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about c#