.net - How do you redirect to the calling page in ASP.NET MVC? -


Assume that I have a controller action that removes an item from a user's shopping cart. The action of this controller starts with a URL ~ / delete / {id}. If I have several pages on my application that will post this URL, how do I take the controller's action to post back to that page? -Text "itemprop =" text ">

You should provide a redirection page parameter from the posting page.

Relying on referrer headers is not a good practice.

Instead , Something like this:

  Delete Public Action Delete (int id, string redirectToUrl) {// Check if the redirect TORRL is empty or empty and accordingly redirects}  

current posting view or partial view Meters can provide:

  <% = Html.Hidden ("RedirecToUrl", "/ my / lovely / url")%>  

or

  & lt; form action = "/ item / delete / 22" I like the first option. 


Comments