Click here to Skip to main content
15,914,162 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Timeout Problem Pin
SreejithKumar M14-May-10 20:15
SreejithKumar M14-May-10 20:15 
GeneralRe: Timeout Problem Pin
Brij14-May-10 20:26
mentorBrij14-May-10 20:26 
GeneralRe: Timeout Problem Pin
SreejithKumar M14-May-10 20:33
SreejithKumar M14-May-10 20:33 
GeneralRe: Timeout Problem Pin
Brij15-May-10 18:01
mentorBrij15-May-10 18:01 
GeneralRe: Timeout Problem Pin
SreejithKumar M16-May-10 17:06
SreejithKumar M16-May-10 17:06 
GeneralRe: Timeout Problem Pin
Suresh Pirsquare18-May-10 3:43
Suresh Pirsquare18-May-10 3:43 
AnswerRe: Timeout Problem Pin
Sandeep Mewara15-May-10 18:56
mveSandeep Mewara15-May-10 18:56 
QuestionHow to e-mail 404 errors Pin
Larry Antram14-May-10 14:06
Larry Antram14-May-10 14:06 
I want to be notified of any 404 (Page not found) errors via e-mail. I'm using Windows Server 2008, ASP.NET 3.5, C# code-behind, etc.

I have a page, that displays just fine upon 404 error, with the following in code-behind Page_Load():

// Send Email to Admin
System.Net.Mail.MailAddress from = new System.Net.Mail.MailAddress("from@domain.com");
System.Net.Mail.MailAddress to = new System.Net.Mail.MailAddress("to@domain.com");
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(from,to);

    message.Subject = "404 - File or directory not found";
    message.Body = String.Format(
        "The following page generated a 404 error:\n{0}\n",
        Convert.ToString(Request.QueryString["aspxerrorpath"]) );

System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("mail.domain.com", 2525);

try
{
    client.Send(message);
}
catch
{
}


I've tried various stuff instead of Request.QueryString["aspxerrorpath"], however I always end up with an e-mail message similar to the following:

From: from@domain.com [mailto:from@domain.com] 
Sent: Friday, May 14, 2010 4:50 PM
To: to@domain.com
Subject: 404 - File or directory not found

The following page generated a 404 error:

And that's it. How can I figure out what page generated the error so I can e-mail the URL or location? Specifically, given the above example, what should I replace Request.QueryString["aspxerrorpath"] with?

Any ideas appreciated. Thanks in advance.
AnswerRe: How to e-mail 404 errors Pin
Larry Antram15-May-10 9:23
Larry Antram15-May-10 9:23 
QuestionPlease give me answer Pin
indian14314-May-10 12:10
indian14314-May-10 12:10 
AnswerRe: Please give me answer Pin
Dr.Walt Fair, PE14-May-10 12:39
professionalDr.Walt Fair, PE14-May-10 12:39 
GeneralRe: Please give me answer Pin
indian14314-May-10 12:59
indian14314-May-10 12:59 
GeneralRe: Please give me answer Pin
Dr.Walt Fair, PE14-May-10 13:09
professionalDr.Walt Fair, PE14-May-10 13:09 
GeneralRe: Please give me answer Pin
Not Active14-May-10 15:43
mentorNot Active14-May-10 15:43 
GeneralRe: Please give me answer Pin
indian14314-May-10 16:02
indian14314-May-10 16:02 
QuestionChanging the style sheet for a asp content page based on the version of IE (javascript?) Pin
Steve Holdorf14-May-10 6:46
Steve Holdorf14-May-10 6:46 
AnswerRe: Changing the style sheet for a asp content page based on the version of IE (javascript?) Pin
Brij14-May-10 7:54
mentorBrij14-May-10 7:54 
AnswerRe: Changing the style sheet for a asp content page based on the version of IE (javascript?) Pin
Steve Holdorf15-May-10 6:08
Steve Holdorf15-May-10 6:08 
QuestionSingleton Pattern Pin
Brendan Vogt14-May-10 5:36
Brendan Vogt14-May-10 5:36 
AnswerRe: Singleton Pattern Pin
Brij14-May-10 7:56
mentorBrij14-May-10 7:56 
GeneralRe: Singleton Pattern Pin
Brendan Vogt14-May-10 8:56
Brendan Vogt14-May-10 8:56 
QuestionASTreeView help Pin
vishnukamath14-May-10 2:24
vishnukamath14-May-10 2:24 
QuestionCannot open database "ASPState" requested by the login. The login failed Pin
Satish_S14-May-10 2:17
Satish_S14-May-10 2:17 
AnswerRe: Cannot open database "ASPState" requested by the login. The login failed Pin
saini arun14-May-10 2:36
saini arun14-May-10 2:36 
GeneralRe: Cannot open database "ASPState" requested by the login. The login failed Pin
Satish_S14-May-10 2:42
Satish_S14-May-10 2:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.