Announcement

Collapse
No announcement yet.

How to send email from Error page in IIS?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to send email from Error page in IIS?

    I have a custom error page set up in IIS using httperrors.

    I need to send out an email simply detailing the page that contained the error.

    How can I achieve this? What would be the simplest way?

    Thanks

  • #2
    You can find the answer here

    http://www.orcsweb.com/blog/jamie-fu...-with-asp-net/

    by making a customs page you can use that to send email as well.
    Edit:
    Just realized you already have custom errors, so here is the code to make an email send.
    http://stackoverflow.com/questions/1...or-page-in-iis
    Last edited by scoutt; 11-14-2013, 09:41 AM.
    Have a Script or Snippet you want to share?

    WWW Standards: HTML 4.01,
    HTML 5, CSS2.1, CSS3, XHTML 1.0
    PHP Standards: PHP Standards

    Comment


    • #3
      Originally posted by scoutt View Post
      You can find the answer here

      http://www.orcsweb.com/blog/jamie-fu...-with-asp-net/

      by making a customs page you can use that to send email as well.
      Edit:
      Just realized you already have custom errors, so here is the code to make an email send.
      http://stackoverflow.com/questions/1...or-page-in-iis
      Scoutt is partially correct. HttpError pages do not allow you direct access to the error anymore. Instead you should create a "basepage" that all your pages inherit from. It is a class that inherits the "System.Web.UI.Page" class (in place of the one on the actual page) and then implement the "Page_OnError(object s,EventArgs e) signature for a method in the class (it will auto wire the event in the sequence). In this method you can use "Server.GetLastError()" method to access the exception event.

      From there using your original page you can inherit your new class in place of the "System.Web.UI.Page".

      You can still implement the HttpErrorPage as Scoutt suggested (gives the users a nice clean page instead of an exception message).
      www.shapemetrics.com
      Red GateSQL tools for DBA

      Comment

      Working...
      X