title: Custom 404 error not redirecting properly
body: <p>I have this custom error redirect in my web.config file but it doesn't seem to be working since i added the <code>redirectMode="ResponseRewrite"</code></p>
  
  <p>It works fine for 500 errors but not for 404 (it just doesn't redirect when i have a 404)</p>
  
  <p>Here's the code from <code>web.config</code> </p>
  
  <pre><code>&lt;customErrors mode="On" redirectMode="ResponseRewrite"&gt; 
     &lt;error statusCode="404" redirect="/servererror/default.aspx" /&gt; 
     &lt;error statusCode="500" redirect="/servererror/default.aspx" /&gt; 
  &lt;/customErrors&gt;
  </code></pre>
  
  <p>And here's my <code>servererror/default.aspx</code> code</p>
  
  <pre><code>Dim err As System.Exception = Server.GetLastError()
  
  Dim Errormail = New MailMessage
  
       'Send email to Bondholder using email address from form
       Errormail.To           = "email@email.co.uk"
  
       Errormail.From         = "servererror@email.co.uk"
       Errormail.Subject      = "Server Error Alert"
       Errormail.BodyFormat   = MailFormat.Text
       Errormail.Priority     = MailPriority.Normal
       Errormail.Body         = ("Error on page - " &amp; err.InnerException.Message &amp; vbcrlf &amp; vbcrlf &amp; "URL of the page - " &amp; Request.Url.ToString())
  
       SmtpMail.SmtpServer    = "localhost"
  
       SmtpMail.Send(Errormail)
  </code></pre>
  
  <p>I need to keep the <code>redirectMode="ResponseRewrite"</code> so that the <code>servererror/default.aspx</code> sends me an e-mail when there's an error</p>
  
  <p>Any help would be much appreciated </p>
  
  <p>Thanks</p>
  
  <p>Jamie</p>
  
  <p>UPDATE</p>
  
  <p>I've had a look around the web and found quite a few other people having the same issues but I can't find a definitive answer.</p>
  
  <p>Any ideas</p>
  
  <p>Thanks</p>
  
  <p>Jamie</p>