0

Hi can anyone help with this.

I have an action result in an umbraco surface controller. if the model is valid i then want to redirect to another page, but for some reason nothing I try will redirect. the things I have tried so far are

            return RedirectToAction("actionname", "controller", "routevalues")
            return RedirectToAction("TeamUpdatePage", "TeamUpdatePageSurface", new { i = id });
            return JavaScript("$(function() { window.location.href = '/contacts/teams/update?i=" + id + "'; });");
            return this.Redirect("/contacts/teams/update?i=" + id);
            return new RedirectResult("/contacts/teams/update?i=" + id, false);
            return RedirectToUmbracoUrlResult("/contacts/teams/update?i=" + id);
            return RedirectToCurrentUmbracoPage("/contacts/teams/update?i=" + id);
            return new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary(new { action = "TeamUpdatePage", controller = "TeamUpdatePageSurface" }));
            Response.Redirect("/contacts/teams/update?i=" + id);
            return Redirect("/contacts/teams/update?i=" + id);
            return new RedirectResult("/contacts/teams/update?i=" + id);

Can anyone tell me why nothing seems to work, and what I can use that will work?

thanks

andrew slaughter
  • 909
  • 4
  • 15
  • 30
  • Sorry forgot to mention the third one does work, but is really wrong to re load the page and then use JS to redirect – andrew slaughter Mar 02 '17 at 10:39
  • Is this method a child action? If so then this is a limitation of MVC, see [this thread](https://our.umbraco.org/forum/developers/api-questions/49022-Surface-Controller-error-Child-actions-are-not-allowed-to-perform-redirect-actions) on the Umbraco forum for more info. – Rob Purcell Mar 02 '17 at 13:58
  • thanks I've had a look, but I have actually got it to redirect client side just checked the parameter exists using JS first – andrew slaughter Mar 02 '17 at 14:54

0 Answers0