I'm calling a function from AJAX
$.ajax({
type: "POST",
url: "GetOneApple",
data: {},
dataType: "json",
success: function (data) {}
});
Home Controller :
[HttpPost]
public ActionResult GetOneApple()
{
try
{
..snip
}
catch (Exception e)
{
return RedirectToAction("ErrorPage", "Home");
}
}
In catch block I have also tried this:
return new RedirectToRouteResult(new RouteValueDictionary {
{ "Controller", "Home" },
{ "Action", "ErrorPage" }
});
I have a ErrorPage controller like this
public ActionResult ErrorPage()
{
return View();
}
as i mentioned,
if any error occurred in the try block it has to redirect to ErrorPage
but page is not redirecting, using firebug i got the "ErrorPage" html in the AjaxResponse from the controller, even though its not redirecting to "ErrorPage" view
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...