Subscribe - It's FREE!!

Stay Connected Here

Stay Updated With Us Here


Redirect() vs RedirectPermanent in ASP.NET MVC- Understand temporary and permanent redirection types.

Share with WhatsApp

Hello friend, in this simple post I am going to share information about Redirect() and RedirectPermanent() methods available in ASP.NET and MVC for redirection purpose.

Many developers, especially fresher developers use these methods blindly and mostly they use only Redirect one without understanding the correct use. I decided to share this as one of the junior developer in my team has asked this question to me while I am reviewing his code as he were not aware about its meaning and purpose after explaining him I though better If share the same here for other developers like him.

Let’s start with it.

Redirect and RedirectPermanent both are methods of HttpResponse Class which provides facility to redirect user to another page or URL. There are several other methods too e.g. RedirectToRoute and RedirectToAction with permanent option but the main difference between Redirect and RedirectPermanent will make you clear about the use of these other methods.

Main difference between Redirect and RedirectPermanent is when you use Redirect or any of its overloaded versions to redirect user it sends an HTTP 302 status code to the browser on the other hand RedirectPermanent sends HTTP 301 status code.

If you don’t know what are these code you can check out this link to know more about HTTP 301 and HTTP 302. In simple words HTTP 301 says that redirection is permanent and HTTP 302 says that this redirection is temporary.

Let's understand this by simple example, When you are vacation you keep "out of office" auto response for your email id which has matter like "I am on leave from ... to .. and will be back on ... Please contact with Mr.X at .. So in this case you can say its type of Redirect() i.e HTTP 302 beacuse you are temporarily not available and directing sender to Mr.X on the other hand if someone gets releived from company a mail like Mr.A has been releived with us and here after please contact Mr.B .... so in this case you can say its permanent redirect i.e. HTTP 301 because Mr.A has been releived permanently and all the duties has been moved to Mr.B.

When you use RedirectPermanent then most of the browsers cache this response and redirects user to the new URL always. Better example I will share that for SEO point of view “” and “” are different URL and it leads to the content duplication if not handled properly so in this case most of the webmasters uses HTTP 301 redirection to tell search engine crawler to consider only one URL.

Hope I have able to explain the difference. Still if you have queries or you have something positive to add this do share in comment section below.

If you enjoyed this post take 5 seconds to share it! Be Socialable. :-)

Share with WhatsApp

Posts To Read Next

Top 10 Visual Studio things which can boost developers coding speed

Visual Studio 2012 provides some coding features by which you can code faster if use them properly. This post will cover top 10 things among them to boost your development speed.

Visual Studio 2008 Shell and TFS integration

Visual Studio 2008 Shell and TFS integration is the problem for all newbies of BIDS and TFS. Here is the solution.

How to call click or any event only once in jQuery

Know how to execute an click event or any event only once for any element in jQuery. Perform action only once and even not required to unbind event.

Assembla - Free and private repository to manage your source code online with SVN subversion hosting

With Assembla you can share source code with others online. Free & Private source code repository with SVN Subversion, Git & Perforce Hosting.

Speed up coding in Visual Studio with code snippets & samples at your fingertips

Know how you can speed up coding in Visual Studio with Bing Developer Assistant by having millions of code snippets and sample projects at fingertips.

Your opinion is valuable for us! Comments, suggetions are welcome.

Submit your Email Id to stay updated with us and get notified with our new posts. It's FREE!
We know this popup is disturbing you!
But We would greatly appreciate if you share us with your friends below!

It will not take more than 2 seconds but will motivate us greatly to write more,share more!