How to redirect full page rather then only partial

2019-06-09 21:21发布

问题:

I have a situation where I am on a controller called customer, and I have an account method which I called using a customer number as the identifier.

I then have an ActionLink that takes me to Arrears task with the task form in a partial view of arrears index. on loading this I store the Request.ServerVariables["http_referer"] so I can use that to return.

When I then use Return Redirect() with the referrer it does the redirect but loads in the partial section like it was loading in an iframe.

Can anyone point me to how to redirect the whole page and not only the partial?

回答1:

Try redirecting to a particular action which will return the the View you want

return RedirectToAction("Index", model);


回答2:

using the following return for the ActionResult return breaks out of the AJAX call and redirects the entire page

    return JavaScript("window.location = 'your specified url'");