Application_Error ???

D

Daniel Groh

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","BooksOnline Log");
}
System.Web.Mail.SmtpMail.SmtpServer = "localhost";
System.Web.Mail.SmtpMail.Send("(e-mail address removed)",
"(e-mail address removed)",
"Application Error",
ex.Message);
EventLog.WriteEntry("BooksOnline",msgErro,EventLogEntryType.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
 
B

Brock Allen

You typically need to be an admin to call:

EventLog.CreateEventSource("BooksOnline","BooksOnline 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top