I'm trying to redirect from my controller during the middle of an Ajax.Actionlink call. I have an Ajax.Actionlink like so:
@Ajax.ActionLink("Send a Project",
"RegisterAjax", "Projects",
new {id = Model.IncidentId},
new AjaxOptions {HttpMethod = "POST", UpdateTargetId = "Projectmsg_" + Model.IncidentId})
Then in my controller, I have the following:
public ActionResult RegisterAjax(int id = 0)
{
string result = RegisterProject(id);
if (result != null)
{
return RedirectResult(result);
}
return Content("Sent...");
}
private ActionResult RedirectResult(string result)
{
throw new NotImplementedException();
}
If result != null
, I've tried the above, return Redirect(result)
, return View(result)
, etc. and nothing gets me to the redirected result page (e.g. ~/Views/Manage/Location.cshtml). I've verified that the result is actually returning the path (by returning it in return Content(result)
) . However, when I click on the hyperlink (i.e. the Ajax.Actionlink), it is completely unresponsive, but I've verified it's doing everything successfully in the background except that redirect.
Anyone know the trick? Many thanks.