title: Correct Controller code for a 301 Redirect
body: <p>I am designing a new dynamic site from a static site.  I have the route all sorted but I have a question on my Action method.</p>
  
  <p>Below is the code but when testing and looking at the headers that Firebug reports, if I take out the Response.End it is a 302 redirect I assume because I set the 301 but then call another action which makes it a 302, but if I put in the Response.End I get a 301.</p>
  
  <p>I am guessing that adding the Response.RedirectLocation is actually doing the 301 redirect so do I therefore change my return value to EmptyResult or null even though that line of code will never get executed just so the app compiles?</p>
  
  <pre><code>public ActionResult MoveOld(string id)
  {
      string pagename = String.Empty;
  
      if(id == "2")
      {
        pagename = WebPage.SingleOrDefault(x =&gt; x.ID == 5).URL;
      }
  
      Response.StatusCode = 301;
      Response.StatusDescription = "301 Moved Permanently";
      Response.RedirectLocation = pagename;
      Response.End();
  
      return RedirectToAction("Details", new { pageName = pagename });
  }
  </code></pre>