title: How to redirect to another view from catch block using MVC
body: <p>I'm calling a function from <strong>AJAX</strong> <br /></p>
  
  <pre><code>$.ajax({
           type: "POST",
           url: "GetOneApple",
           data: {},
           dataType: "json",
           success: function (data) {}
  });
  </code></pre>
  
  <p><strong>Home Controller :</strong></p>
  
  <pre><code>[HttpPost]
  public ActionResult GetOneApple()
  {
       try
         {
        ..snip
         }
       catch (Exception e)
         {
             return RedirectToAction("ErrorPage", "Home");
         }
  }
  </code></pre>
  
  <p>In catch block I have also tried this:</p>
  
  <pre><code>return new RedirectToRouteResult(new RouteValueDictionary {
      { "Controller", "Home" }, 
      { "Action", "ErrorPage" }
  });
  </code></pre>
  
  <p>I have a ErrorPage controller like this</p>
  
  <pre><code> public ActionResult ErrorPage()
          {
              return View();
          }
  </code></pre>
  
  <p>as i mentioned,<br />
   if any error occurred in the try block it has to redirect to ErrorPage
  but page is not redirecting, using <em>firebug</em> i got the "ErrorPage" html  in the <strong>AjaxResponse</strong> from the controller, even though its not redirecting to "ErrorPage" <em>view</em><br /></p>
  
  <p>What am i missing? I´m kind of new to this, so hopefully there is a simple answer that i haven´t been able to find...</p>