I have two actions that list out items. Index() lists out all items and Filtered(string foo) filters the list of items based on foo. When a user creates a new item, I want to be able to redirect them back to either Index() or Filtered(string foo) based on where they were before.
How can I do this, or rework my actions to make this work?
You could modify your ActionResult to accept a string that contains the URL path the user comes from.
Something like this:
I don’t have a ton of experience with ASP.NET MVC so there could be a better built in way to handle this. Googling for ‘asp.net mvc redirect to requestor’ might yield something more useful, that’s essentially what you’re wanting is to redirect back to the requesting route.