I have set a custom error on my server and I am redirecting to a page as shown below
& lt; CustomErrors mode = "current" & gt; & Lt; Error status code = "500" redirect = "/ seperate / default.aspx" /> & Lt; / CustomErrors & gt;
When that page goes to Preventive / Default.aspx
, I need to send an e-mail with the exception . Message
Here is what I am trying to do, but it will not work
sub page_load (as the only sender in the form of the object, -Ool) Dim ErrMessage as an exception to Dim Last Aher LastError = Server.GetLastError () ErrMessage = LastError.Message Dim Errormail = New MailMessage 'Send Email to IromMail. For = "email@email.co.uk" Errormail.From = "servicererror@email.co.uk" Errormail.Subject = "Server Error Alert" Errormail.BodyFormat = MailFormat.Text Errormail.Priority = MailPriority.Normal Errormail Body = ErrMessage SmtpMail.Smtp Server = "Localhost" SmtpMail.Send Server.ClearError () End Sub Jamie
Post-text "itemprop =" text ">
see here:
You must add redirect media:
& lt; CustomErrors mode = "on" redirectMode = "ResponseRewrite"> & lt; / customErrors & gt;
Comments
Post a Comment