How to set up an error page that sends an email?

In my web.config file I turned custom errors on and set the defaultRedirect value to my error page.  My error page does two things:

 1. It display a message "There was an error...please go back and try again or contact us....etc"

 2. It sends me an email, notifying me that there was an error (and then I can check the application log for the error details)

 
It works well, but sometimes it'll send me an email when there are no errors in the application log.  I think this is from web crawlers hitting the page so I'm going to create a robots.txt file


Is it possible to send the error information through the email?  It's not a big deal, I can always check the application log, but it's kind of annoying to check it with the false alarms.


 

0
bank5
2/19/2008 2:39:59 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

1 Replies
474 Views

Similar Articles

[PageSpeed] 56

I made up a trick for this issue. I am not sure if this is optimal. please comment if some one have better idea.

I am using my Application_Error event to perform some checks. There is a big code up there but i will show you how I track a crawler. 

System.Web.HttpBrowserCapabilities browser = Request.Browser;
        string s = "Is a Browser.";//as default

        if (!browser.Crawler)
        {
            s = "Browser Capabilities<br/>"
                + "Type = " + browser.Type + "&lt;br/>"
                + "Version = " + browser.Version + "&lt;br/>"
                + "Platform = " + browser.Platform + "&lt;br/>"
                + ".NET FrameWork Version = " + browser.ClrVersion.ToString() + "&lt;br/>";
        }
        else
        {
            s = "&lt;br/>Is a Crawler";
            if (Server.GetLastError().Message.Contains("does not exist"))
            {
                Response.StatusCode = (int)System.Net.HttpStatusCode.MovedPermanently;
                // now the crawler wont look for this page again if it does not exist
                s = s + @" and URL is Moved Permenently returned";
            }
        }
  now you can use this string "s" as information and send as email to you or just create a Log file.
0
omerkamal
2/20/2008 11:39:06 AM
Reply:

Similar Artilces:

redirecting user when email has been sent to a thankyou page or when the email has not been send to an error page
 Hello, I wrote this code for my email: Imports System.Net.MailPartial Class sendemail_feedbackpage    Inherits System.Web.UI.Page    Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click        Const ToAddress = "myemail@ildw.com"        Dim MM As New MailMessage(UsersEmail.Text, ToAddress)        MM.Subject = "asp.netsubmission form"        MM.Bod...

Sending Email with Net.Mail (No Email, no error)
hi,i'm using the system.net.Mail namespace to send an email from my application. when i send, the application does not fire any exception, neither does it send the email to my account.below is the code i'm using  Dim mmailMessage As New Net.Mail.MailMessage Dim mFrom As New Net.Mail.MailAddress(mailFrom) mmailMessage.From = mFrom Dim ll As String = "myname@ourmail.com" mmailMessage.To.Add(ll) mmailMessage.Subject = "Talk Concerns" mmailMessage.Body = "Testing Concerns One Two" Dim ...

Sending Email from web page-send.objmm error
when icomile the code th folowing error come .I have downloaded the code from http://www.4guysfromrolla.com/webtech/080801-1.shtml .and run it but it give me followin error . ****************************************************** The "SendUsing" configuration value is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The "SendUsing" configuration value is in...

get a security error - get certificate
This has only happened with one person. In trying to send an email to time warner (not an issue I don't think) when he trys to add his signature he gets 'security error' you do not have a security certficate. Talk about being the wrong error for this one. any ideas? GW7sp2 On Wed, 10 Oct 2007 20:18:51 +0000, mark wrote: > This has only happened with one person. In trying to send an email to > time warner (not an issue I don't think) when he trys to add his signature > he gets 'security error' you do not have a security certficate. Talk >...

Sending Email through System.Net.Mail is generating errors "Failure Sending mail
hi Sending Email through System.Web.Mail is working fine but System.Net.Mail is generating errors "Failure Sending mail  i treid in all possible ways but did't  pls help in giving a solution thanks & Regards vittal Maybe you can show us some code and post the exact error mesg as well (by looking at the value in ex.tostring)?My HomePage - www.findingsteve.net"It is more blessed to give than to receive." Acts 20: 35 (NIV, Bible)Progress - "Never discourage anyone...who continually makes progress, no matter how slow." Plato System.Web.Ma...

I can send email from my site, but I get an error when I try to send a cell phone TM.
From all that I can gather sending a TM is very much the same as sending an email. Only thing that changes is who it is being emailed to. That being said however I keep getting this error: Mailbox unavailable. The server response was: <'left out for security reasons'@vtext.com> No such user here at System.Net.Mail.Smtp  Any one know why?? chekmate:Any one know why?? Yep.  The account you tried to email to doesn't exist at the server you tried to send it to.  You got the wrong account, the wrong server or both. JeffPlease: Don't forget to click &...

Get error when sending email
Since updating to SM 2.13.1 from SM 2.12.1, when I go to send an email I get an error to check my Temp file settings, this does not happen every time but quite often. I close the error and try to send again -sometimes the message is sent but some times I have to try three or four times. Any ideas? Error is below: Send Message Error Sending of message failed. Unable to open the temporary file C:\Docume~1\Jamess~1\locals~1\temp\nsmail.temp. Check your 'Temporary Directory' settings. JAS -- You either teach people to treat you with dignity and respect, or you don'...

Error Sending Email from .NET
Hey there.Ive made a signup script that authenticates users email by sending an activation code to their email address. The problem im getting is the following...The server rejected one or more recipient addresses. The server response was: 503 This mail server requires authentication. Please check your mail client settings. Now Ive been told this can be sorted via settings on the server but Ive emailed my hosting providers and they cant/wont change these settings... so is there any way I can get around this from within ASP.NETI would really appreciate any and all suggestions. Many Regards ...

Email gets a send error but still goes into Sent folder. Sometimes successfully sends and sometimes doesn't
The error message we recieve sometimes on an employee's computer when sendi= ng mail reads "An error occured while sending mail. The mail server respond= ed: Resources temporarily unavailable - Please try again later. Please chec= k the message and try again" Thunderbird then proceeds to put the message in the Sent folder after hitti= ng OK, defeating the purpose of the error in my opinion. Whether or not it successfully sends is completely unknown to us unless the= person replies or the person it was emailed to is within our office; howev= er, when sending the email...

Getting things back in Start Page and things out of Start Page
I know I posted over a year ago about this same question, I can not find my original post though. I know I posted it and I did find the solution and posted the sollution but I can not find it anywhere here again. They really need a better search engine on these forums. Is there any tools out there to help manage the start page? For example. I have projects that are on a web server I access them on the remote server. Well the start page never ever shows any updates for it the date posted as last access is the day I created it, However this is one of my more used projects. This one is so b...

Suddenly Getting Error When Sending Email
 i could send email for a few days using this code below: MailMessage message = new MailMessage();                   message.From = new MailAddress(ConfigurationSettings.AppSettings["fromEmailAddress"]);                                 message.To.Add(new MailAddress(email));         &nbs...

Trying to send an email and getting an error
Hi Folks,  I have been having a few problems when trying to send an email via an online system i am getting the error:  Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)) This error occurs when i click on the send button. Do any of you have an idea what this may be or have you come across this before??  Also is there an easy way to pick up a users default mail server and use it to send the email as i am dealing with multiple mail servers? Localhost does not work in this instance.  Thanks for any help, Cheers First, al...

Proxy Setting in Email sending with .net
I am using below code for sending Email using .net. Its not working on client machine. My server IP is:- 192.168.10.10 and also uses proxy and user-name and password for proxy settings are user-name:- user and password:-user. Where I have to specify this proxy settings in my below code.  Dim message As New MailMessage()                       message.From = New MailAddress(txtFrom.Text.Trim())              &...

How to set a start page which is there in a sub-folder as my start page (virtual directoty)
i have a virtual directory and it contains one folder under which i got my start page??Virtual Directory: XXX                              Sub-folder:XX --- > start.aspx now how can set this start.aspx which is under a sub-folder to be my start page???  thanks a lot in advance  browse to that file in Solution explorer of Visual Studio and right click on that page and set as start page. Raghu(MCSD.NET, MCAD.NET, MCDBA)[Don't forget to click on Mark as ans...

Web resources about - How to set up an error page that sends an email? - asp.net.getting-started

Email - Wikipedia, the free encyclopedia
is a method of exchanging digital messages from an author to one or more recipients. Modern email operates across the Internet or other computer ...

Microsoft Outlook for iOS updated with 3D Touch and email printing
... forward with new features as though to present themselves as viable alternatives to the soon-to-be defunct gesture-based multi-service email ...

"After UW-Madison chancellor's email stirred controversy, Regents prepare resolution on free speech." ...
The Wisconsin State Journal reports. The email, sent to students by Rebecca Blank on November 13th included: "While individuals are always free ...

Where's outrage from White House over McDonald shooting? It comes by email
Have you watched the news about President Barack Obama and Hillary Clinton loudly demanding justice in the Laquan McDonald case in Chicago?

Here Are The Most Glaring Examples Of Favoritism Revealed In Hillary’s Emails So Far
Here Are The Most Glaring Examples Of Favoritism Revealed In Hillary’s Emails So Far

Growing Your Business with Email Marketing Templates
Growing Your Business with Email Marketing Templates written by Guest Post read more at Duct Tape Marketing photo credit: Flickr Which templates ...

Mailbox's Death Shows Good Design Alone Can't Unbreak Email
R.I.P. Mailbox. Born: February, 2013, Died: December, 2015. Related: There's No Such Thing As A Perfectly Designed Email App (And That's Okay) ...

Read This Google Email About Time Management Strategy
A Google employee teaches his colleagues how to block out interruptions and set aside "make time." I recently wrote an email to our team that ...

FAMILY BUSINESS? Group wants Hillary probe over son-in-law's email
FAMILY BUSINESS? Group wants Hillary probe over son-in-law's email

Judge Rejects Chicago Cop Suit Seeking OT for off-Duty Email
Judge decides against Chicago cops who argued for overtime for reading emails after work hours

Resources last updated: 12/15/2015 8:31:49 AM