Redirect vs RedirectPermanent in ASP.NET MVC

Posted by : Rakesh Sinha
Posted On : 11/29/2015 9:23:22 PM
Posted As :Question Answers
Category :Software Development
View : 1963
                 The basic difference between these two is that RedirectPermanent sends the browser an HTTP 301  status code (Moved Permanently)  whereas Redirect will send an HTTP 302 status code.

Use RedirectPermanent if the resource has been moved permanently and will no longer be accessible in its previous location. Most browsers will cache this response and perform the redirect automatically without requesting the original resource again.

Use Redirect if the resource may be available in the same location (URL) in the future.

For Example

Lets say that you have users in your system. You also have an option to delete existing users. Your website has a resource /user/{userid} that displays the details of a given user. If the user has been deleted, you must redirect to the /user/does-not-exist page. In this case:

If the user will never be restored again, you should use RedirectPermanent so the browser can go directly to /users/not-exist in subsequent requests even if the URL points to /users/userid.

If the user may be undeleted sometime in the future, you should use a regular Redirect.
 
when a Project really is Agile
Submitted in: Ask Question | Category: Project Management
what is Data Binding?
Submitted in: Ask Question | Category: Software Development
how to pass data from one activity to another activity?
Submitted in: Ask Question | Category: Software Development
What is Data Annotations ?
Submitted in: Ask Question | Category: Software Development
What is difference between $Scope and $rootScope ?
Submitted in: Ask Question | Category: Software Development
What is difference between TextBox and TextBoxFor?
Submitted in: Ask Question | Category: Software Development
how to send selected data to another page on button click
Submitted in: Ask Question | Category: Software Development
what is attribute routing in asp.net mvc
Submitted in: Ask Question | Category: Software Development
What’s an Object ?
Submitted in: Ask Question | Category: Software Development
What is the Android Architecture?
Submitted in: Ask Question | Category: Software Development
What is difference between account payable and bills payable?
Submitted in: Ask Question | Category: Accounting
What is the diff. between abstract class & interface
Submitted in: Ask Question | Category: Software Developement

All rights reserved to Interviewfunda.com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. While using this site, you agree to have read and accepted our terms of use and privacy policy. Best viewed at 1024 x 768 resolution with Internet Explorer 5.0 or Mozila Firefox 3.5 or Google Crome and higher