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

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

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");     } } 

Dynamic content in static content


Id with / causes problems with routing [duplicate]
You must use Response.Redirect wherever you like although you need to provide a proper (relative or abolute) URL, not just an action name. How to define route & controller structure for 2 controllers? However, it would be preferable to stick to the MVC pattern and did any thing like this:. ASP.NET MVC - HTML.BeginForm and SSL
[Accept(HttpVerbs.Post)]  public ActionResult NerdDinner(string Name)  {     ActionResult testResult = testName(Name)    if (testResult != null) return testResult;    ... mvc IDataErrorInfo validation when using ViewModel    return RedirectToAction("ActionResultAAA");  }   private ActionResult testName(string name)  {      if(name == null)      {          return RedirectToAction("ActionResultBBB");      }       return null; } 
How to make data available when one Controller's View calls another Controller's View?

79 out of 100 based on 54 user ratings 589 reviews