473,387 Members | 1,569 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,387 software developers and data experts.

Application.Error event

I need help figuring out why the Application_Error event on my global.asax
is not working. When I run my web application, I do get an error on the
screen but no log file/record is created. Here is the code I have for the
Application_Error in my global.asax:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim unhandledException As Exception =
Server.GetLastError().InnerException

If Not EventLog.SourceExists("Mileage Efficiency Calculator") Then
EventLog.CreateEventSource("Mileage Efficiency Calculator",
"Mileage Efficiency Calculator Log")
End If

Dim el As EventLog = New EventLog
el.Source = "Mileage Efficiency Calculator"
el.WriteEntry(unhandledException.Message)
Response.Write("An exceptin occurred: Created an entry in the event
log ")
Server.ClearError()
End Sub

Is this a permission issue? Is there something I need to set up so my
application has the rights to create the new log file?

Thanks for your help.
Nov 18 '05 #1
3 1073
Hi Sal,

Yeah I think so. To check add your ASPNET/NETWORK SERVICE account
temporarily as an ADMIN user and see if it starts working. I wouldn't be
surprised if you don't need extended rights to create a new Eventlog source.

FWIW, I don't think it's a good idea to log stuff like that into the
EventLog. I would opt for an application specific log into an XML file in
the application directory or into a Database table. I would reserve the
EventLog for errors of more severity. Just my 2 cents <g>...
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Sal Young" <sa******@comcast.net> wrote in message
news:Cq********************@comcast.com...
I need help figuring out why the Application_Error event on my global.asax
is not working. When I run my web application, I do get an error on the
screen but no log file/record is created. Here is the code I have for the
Application_Error in my global.asax:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim unhandledException As Exception =
Server.GetLastError().InnerException

If Not EventLog.SourceExists("Mileage Efficiency Calculator") Then
EventLog.CreateEventSource("Mileage Efficiency Calculator",
"Mileage Efficiency Calculator Log")
End If

Dim el As EventLog = New EventLog
el.Source = "Mileage Efficiency Calculator"
el.WriteEntry(unhandledException.Message)
Response.Write("An exceptin occurred: Created an entry in the event log ")
Server.ClearError()
End Sub

Is this a permission issue? Is there something I need to set up so my
application has the rights to create the new log file?

Thanks for your help.

Nov 18 '05 #2
Rick,

Thank you for your prompt reply. I did try what you suggested and added the
ASPNET account as a Administrator and that didn't solved the problem.

I'm really opposed to logging errors in a database because sometimes we get
database timeout errors; therefore, we can't access the database to log the
error.


"Sal Young" <sa******@comcast.net> wrote in message
news:Cq********************@comcast.com...
I need help figuring out why the Application_Error event on my global.asax
is not working. When I run my web application, I do get an error on the
screen but no log file/record is created. Here is the code I have for the
Application_Error in my global.asax:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim unhandledException As Exception =
Server.GetLastError().InnerException

If Not EventLog.SourceExists("Mileage Efficiency Calculator") Then
EventLog.CreateEventSource("Mileage Efficiency Calculator",
"Mileage Efficiency Calculator Log")
End If

Dim el As EventLog = New EventLog
el.Source = "Mileage Efficiency Calculator"
el.WriteEntry(unhandledException.Message)
Response.Write("An exceptin occurred: Created an entry in the event log ")
Server.ClearError()
End Sub

Is this a permission issue? Is there something I need to set up so my
application has the rights to create the new log file?

Thanks for your help.

Nov 18 '05 #3
Is there some sort of error that occurs with the logging? If the log is not
being written to you should be able to trap the error that is occuring in a
Try/Catch blcok.

As to logging to file - I understand that issue, hence the other suggestion
to log to an XML or text file. Whatever works.

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"Sal Young" <sa******@comcast.net> wrote in message
news:Pd********************@comcast.com...
Rick,

Thank you for your prompt reply. I did try what you suggested and added the ASPNET account as a Administrator and that didn't solved the problem.

I'm really opposed to logging errors in a database because sometimes we get database timeout errors; therefore, we can't access the database to log the error.


"Sal Young" <sa******@comcast.net> wrote in message
news:Cq********************@comcast.com...
I need help figuring out why the Application_Error event on my global.asax is not working. When I run my web application, I do get an error on the
screen but no log file/record is created. Here is the code I have for the Application_Error in my global.asax:

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim unhandledException As Exception =
Server.GetLastError().InnerException

If Not EventLog.SourceExists("Mileage Efficiency Calculator") Then EventLog.CreateEventSource("Mileage Efficiency Calculator",
"Mileage Efficiency Calculator Log")
End If

Dim el As EventLog = New EventLog
el.Source = "Mileage Efficiency Calculator"
el.WriteEntry(unhandledException.Message)
Response.Write("An exceptin occurred: Created an entry in the

event
log ")
Server.ClearError()
End Sub

Is this a permission issue? Is there something I need to set up so my
application has the rights to create the new log file?

Thanks for your help.


Nov 18 '05 #4

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

Similar topics

5
by: VinnieT | last post by:
I have a load balanced system that consists of 3 production servers. There are about 20 different applications that are used on these boxes. One of my applications in particular is used more than...
0
by: Umair Ahmed | last post by:
Hi, I m developing a web application on Win2k platform and deploying the application on Win2k platform. I didnt get any error on the development machine but when i deployed to any machine on...
9
by: Steve Buster | last post by:
All right, I have read every forum, newsgroup etc about this issue and no one seems to know how to fix it. I am getting a "Server Application Unavailable" exception running my .NET 1.1...
1
by: Robert Halford | last post by:
On 4th May at 7.45 in the evening my asp.net web sites stopped working on my development server. The page that appears says: Server Application Unavailable The web application you are...
0
by: bruce | last post by:
ASP.NET app running for about a year with no problem and suddenly this week it's giving error message. The same as the one decribed by another user. Even stranger is that we only have this problem...
1
by: whitehorse | last post by:
When the warehousecontroller service is invoked, the following error message is sent to the application log: Event Type: Error Event Source: TFS Warehouse Event Category: None Event ID: 3000...
2
by: Ronald | last post by:
I just started with dotnetnuke, and with a wrong login (wrong password on a clean install i can crash the application pool from IIS. (when i login with the right username/password information the...
4
by: David Lozzi | last post by:
Howdy, I found a nice little book called ASP.NET 2.0 Cookbook by Michael A Kittel and Geoffrey LeBlond. Anyway, they have some instructions on how to setup application level error handling. Most...
17
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have set up a virtual directory using IIS. Whenever, I load a web page of type .htm, I have no problem. Whenever I run a .aspx page I get the statement below. I am running on XP Pro, both...
0
by: Steve | last post by:
Hello- Your assistance with this issue is greatly appreciated. Environment: - Load-balanced IIS 6.0 servers (Win2003) - web servers point (via UNC path) to a Microsoft File Cluster on...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.