RedirectToAction allows you to create a redirect URL for a specific action / controller in your application, i.e. it will use a route table to create the correct URL.
Redirect requires that you provide the full URL for the redirect.
If you have an Index action on the Home controller with the Id parameter:
You can use RedirectToAction("Index", "Home", new { id = 5 }) , which will generate a URL for you based on your route table.
You can use Redirect , but you must create the URL yourself, so you pass in Redirect("/Home/Index/5") or, nevertheless, use your route table.
You cannot redirect to google.com (external URL) using RedirectToAction , you must use Redirect .
RedirectToAction designed to perform 302 redirects in your application and gives you an easier way to work with your route table.
Redirect designed for 302 redirects to all other, in particular external URLs, but you can still redirect in your application, you just need to create URLs yourself.
Recommendations: Use RedirectToAction for any actions with your actions / application controllers. If you use Redirect and provide a URL, you will need to manually change these URLs when the route table changes.
Omar Aug 30 '12 at 14:21 2012-08-30 14:21
source share