I have this custom error redirect in my web.config file but it doesn't seem to be working since i added the redirectMode="ResponseRewrite"
It works fine for 500 errors but not for 404 (it just doesn't redirect when i have a 404)
Here's the code from web.config
<customErrors mode="On" redirectMode="ResponseRewrite">
<error statusCode="404" redirect="/servererror/default.aspx" />
<error statusCode="500" redirect="/servererror/default.aspx" />
</customErrors>
And here's my servererror/default.aspx
code
Dim err As System.Exception = Server.GetLastError()
Dim Errormail = New MailMessage
'Send email to Bondholder using email address from form
Errormail.To = "[email protected]"
Errormail.From = "[email protected]"
Errormail.Subject = "Server Error Alert"
Errormail.BodyFormat = MailFormat.Text
Errormail.Priority = MailPriority.Normal
Errormail.Body = ("Error on page - " & err.InnerException.Message & vbcrlf & vbcrlf & "URL of the page - " & Request.Url.ToString())
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Errormail)
I need to keep the redirectMode="ResponseRewrite"
so that the servererror/default.aspx
sends me an e-mail when there's an error
Any help would be much appreciated
Thanks
Jamie
UPDATE
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.
Any ideas
Thanks
Jamie