title: Does Response.RedirectPermanent(); process code after it is called
body: <p>I have the following code which checks an exception and if it is a 404 exception, it will check a list of urls to see if the page has been moved and if it matches, will issue a permanent redirect to the new page:</p>
  
  <pre><code>    protected void Application_Error(object sender, EventArgs e)
      {
          var exception = Server.GetLastError();
          if (exception != null)
          {
              if (exception is HttpException)
              {
                  TryRedirect((HttpException)exception);
              }
  
              LogError(exception);
          }
      }
  
      private void TryRedirect(HttpException httpException)
      {
          if (httpException.GetHttpCode() == 404)
          {
              WebsiteRedirect redirect = SiteCache.Redirects.FirstOrDefault(x =&gt; string.Compare(x.LegacyURL, HttpContext.Current.Request.RawUrl, true) == 0);
  
              if (redirect != null)
              {
                  // 301 it to the new url
                  Response.RedirectPermanent(redirect.NewURL);
              }
          }
      }
  </code></pre>
  
  <p>Now I would expect that after the redirect has happened, non of the code after it would be executed ie the <code>LogError</code> function wouldn't be called.  But it seems to be as I am getting error messages for the pages not being found.  </p>
  
  <p>Is this standard behaviour for MVC <code>Response.RedirectPermanent</code>?</p>