Reputation: 39444
I have an ASP.NET MVC Action:
public virtual ActionResult Show(Int32 id, String slug) {
} // Show
How can I, inside Show, redirect to another action?
I need to fire the 301 redirect HTTP Error to inform that the old url should be replaced by the new url.
How can I do this?
Thank You, Miguel
Upvotes: 0
Views: 577
Reputation: 8406
You can use RedirectToActionPermanent.
That said, it is important to know that a response status 301 will make browsers to never ask for the original location again. For a simple redirection (302) use RedirectToAction.
Both methods are used basically in the same way. In this StackOVerflow answer there are some excellent examples.
Upvotes: 3