473,385 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Application_Error ???

Hi, I have this code in my Application_Error:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Context.Error.GetBaseException();
string msgErro = ex.Message + " - " + ex.StackTrace;
if(!EventLog.SourceExists("BooksOnline"))
{
EventLog.CreateEventSource("BooksOnline","BooksOnl ine Log");
}
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send("er******@booksonlin e.com.br",
"ad***@booksonline.com.br",
"Application Error",
ex.Message);
EventLog.WriteEntry("BooksOnline",msgErro,EventLog EntryType.Error);
}

It does not work...I already tryed the code that is sending email and
everything is running ok, but it is not going to Application_Error, should I
specify something in my web.config ? it's now RemoteOnly!

Thanks in advance

Daniel
Nov 19 '05 #1
1 989
You typically need to be an admin to call:

EventLog.CreateEventSource("BooksOnline","BooksOnl ine Log");

Which is not the default identity for the ASP.NET worker process. You should
run a little admin tool to do this one line of code on the target machine.

-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi, I have this code in my Application_Error:

protected void Application_Error(Object sender, EventArgs e)
{
Exception ex = Context.Error.GetBaseException();
string msgErro = ex.Message + " - " + ex.StackTrace;
if(!EventLog.SourceExists("BooksOnline"))
{
EventLog.CreateEventSource("BooksOnline","BooksOnl ine Log");
}
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send("er******@booksonlin e.com.br",
"ad***@booksonline.com.br",
"Application Error",
ex.Message);

EventLog.WriteEntry("BooksOnline",msgErro,EventLog EntryType.Error);
}
It does not work...I already tryed the code that is sending email and
everything is running ok, but it is not going to Application_Error,
should I specify something in my web.config ? it's now RemoteOnly!

Thanks in advance

Daniel


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Greg Burns | last post by:
I am trying to write a global custom error page. I thought I would jot down some of what I've learned so far... At first I just used the default customErrors section with a defaultRedirect tag,...
3
by: tafs7 | last post by:
My code below is supposed to email me when an error occurs on the application, but it's not emailing anything. Am I missing something? I know the smtp servers I've tried work. I even added a...
0
by: Michael | last post by:
Hi, I have an ASP.NET application that catches un-handled exceptions in the Application_Error method and writes the details to the Event Log. But, if I do a Server.ClearError() followed by either...
0
by: Michael | last post by:
Hi, I have an ASP.NET application that catches un-handled exceptions in the Application_Error method and writes the details to the Event Log. But, if I do a Server.ClearError() followed by either...
6
by: Matt | last post by:
Can anyone give me a good reason to use BOTH application scope Page_Error and the page scope Page_Error when trapping errors in a web application? Is there any real benefit to using the Page_Error...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.