Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1110201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:21:31+00:00 2026-05-17T02:21:31+00:00

I have set up custom error on my server and i’m redirecting to a

  • 0

I have set up custom error on my server and i’m redirecting to a page as shown below

<customErrors mode="On"> 
   <error statusCode="500" redirect="/servererror/default.aspx" /> 
</customErrors>

When it gets to the page servererror/default.aspx I need it to send an e-mail to me with the exception.message

Here’s what i’m trying but it won’t work

Sub Page_load(ByVal sender As Object, ByVal e As EventArgs)

     Dim LastError As Exception
     Dim ErrMessage As String

     LastError = Server.GetLastError()


        ErrMessage = LastError.Message


Dim Errormail = New MailMessage

     'Send email to me
     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         = ErrMessage

     SmtpMail.SmtpServer    = "localhost"

     SmtpMail.Send(Errormail)

     Server.ClearError()
End Sub

Any help would be much appreciated

Thanks

Jamie

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T02:21:32+00:00Added an answer on May 17, 2026 at 2:21 am

    Look here:
    ASP.NET custom error page – Server.GetLastError() is null

    you need to add the redirectmode:

    <customErrors mode="On" redirectMode="ResponseRewrite"> 
       <error statusCode="500" redirect="/servererror/default.aspx" /> 
    </customErrors>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom error page set up for my application: <customErrors mode=On defaultRedirect=~/errors/GeneralError.aspx
I have ASP.NET set up to use the CustomErrors functionality: <customErrors mode=On defaultRedirect=~/ErrorPages/500.aspx redirectMode=ResponseRewrite>
I have the following in my web.config <httpErrors errorMode="Custom"> <remove statusCode="500" subStatusCode="-1" /> <error
So i have just set new Error Handlers in httpd.conf for custom error pages:
I have custom errors enabled in my web.config file: <customErrors mode=On defaultRedirect=~/ErrorPage.aspx /> When
Here's the situation: - I have <customErrors mode=On defaultRedirect=error.html /> in my web.config. I
I have set my default-input-method variable to english-dvorak: (custom-set-variables '(default-input-method english-dvorak)) When I launch
I have set onItemClicklistener on my custom list view but onItemClicklistener not working I
Say I have a set myset of custom objects that may be equal although
I have a custom UITableViewCell subclass. I have set the contentView of my cell

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.