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

Error messages

I am trying to write to a event log using the EventLog Class in a ASP.net
application.
The following code was added to 'Aplication_Error' subroutine in the
'Global.asax' file
Public Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

Dim ErrorDescription As String = Server.GetLastError.ToString()

'Creation of event log if it does not exist

Dim EventLogName As String = "ErrorSample"

If Not EventLog.sourceExists(EventLogName) Then
' Problem1 Error Message = SourceExists is not a member of
EventLog

EventLog.CreateEventSource(EventLogName, EventLogName)
' Problem2 Error Message = CreateEventSource is not a member of
EventLog

End If

'Inserting into eventlog

Dim Log As New eventlog()

Log.Source = EventLogName

Log.WriteEntry(ErrorDescription, EventLogEntryType.Error)

End Sub

I am using Microsoft Development Environment 2002 version 7.0.9466 &
Microsoft.NET framework 1.0 version 1.0.3705

Please suggest some solution to the above problem.

TIA,

Gary
Nov 17 '05 #1
2 2195
Kevin,

There are two problems
1. Error Message = SourceExists is not a member of EventLog at line:
If Not EventLog.sourceExists(EventLogName) Then

2. Error Message = CreateEventSource is not a member of EventLog at line:
EventLog.CreateEventSource(EventLogName, EventLogName)

The problems were written inline the message :-)

Please help me.
Gary
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2*****************@TK2MSFTNGP09.phx.gbl...
I think you forgot to mention what the problem IS.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Gary" <ms****@microsoft.com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
I am trying to write to a event log using the EventLog Class in a ASP.net application.
The following code was added to 'Aplication_Error' subroutine in the
'Global.asax' file
Public Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim ErrorDescription As String = Server.GetLastError.ToString()

'Creation of event log if it does not exist

Dim EventLogName As String = "ErrorSample"

If Not EventLog.sourceExists(EventLogName) Then
' Problem1 Error Message = SourceExists is not a member of
EventLog

EventLog.CreateEventSource(EventLogName, EventLogName)
' Problem2 Error Message = CreateEventSource is not a
member of
EventLog

End If

'Inserting into eventlog

Dim Log As New eventlog()

Log.Source = EventLogName

Log.WriteEntry(ErrorDescription, EventLogEntryType.Error)

End Sub

I am using Microsoft Development Environment 2002 version 7.0.9466 &
Microsoft.NET framework 1.0 version 1.0.3705

Please suggest some solution to the above problem.

TIA,

Gary


Nov 17 '05 #2
Sorry Gary. I missed the inline remarks!

Very strange. The first thing I notice is that you didn't include any code
that, for example, imports System.Diagnostics. Is it there? Another
possibility is that you created an instance of The
System.Diagnostics.EventLog class and named it "EventLog." Did you? The 2
methods you are having problems with are Shared methods, which means that
they can be invoked without an instance of the class. You might try revising
each of them something like the following:

If Not System.Diagnostics.EventLog.SourceExists(EventLogN ame) Then

This would certainly clear up any possible ambiguity that exists.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Gary" <ms****@microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.phx.gbl...
Kevin,

There are two problems
1. Error Message = SourceExists is not a member of EventLog at line:
If Not EventLog.sourceExists(EventLogName) Then

2. Error Message = CreateEventSource is not a member of EventLog at line:
EventLog.CreateEventSource(EventLogName, EventLogName)

The problems were written inline the message :-)

Please help me.
Gary
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:%2*****************@TK2MSFTNGP09.phx.gbl...
I think you forgot to mention what the problem IS.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Gary" <ms****@microsoft.com> wrote in message
news:O%****************@TK2MSFTNGP12.phx.gbl...
I am trying to write to a event log using the EventLog Class in a ASP.net application.
The following code was added to 'Aplication_Error' subroutine in the
'Global.asax' file
Public Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim ErrorDescription As String = Server.GetLastError.ToString()

'Creation of event log if it does not exist

Dim EventLogName As String = "ErrorSample"

If Not EventLog.sourceExists(EventLogName) Then
' Problem1 Error Message = SourceExists is not a member of
EventLog

EventLog.CreateEventSource(EventLogName, EventLogName)
' Problem2 Error Message = CreateEventSource is not a

member
of
EventLog

End If

'Inserting into eventlog

Dim Log As New eventlog()

Log.Source = EventLogName

Log.WriteEntry(ErrorDescription, EventLogEntryType.Error)

End Sub

I am using Microsoft Development Environment 2002 version 7.0.9466 &
Microsoft.NET framework 1.0 version 1.0.3705

Please suggest some solution to the above problem.

TIA,

Gary



Nov 17 '05 #3

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

Similar topics

2
by: lkrubner | last post by:
This is a general computer question, but I'm writing in PHP so I'll post this to comp.lang.php. I've been writing a content management system. I've a Singleton object that keeps track of all...
5
by: Steve | last post by:
Hi; I went to the microsoft site to try to find a guide to the error messages that the jdbc drivers give ( for sqlserver 2000 ). I had no luck. Does anyone know if there is such a guide? ...
10
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address,...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
0
by: Janning Vygen | last post by:
Hi, i have a question about how to handle postgresql constraint errors in the client app. I found some mails in the archive about it, too. But i have still so many questions about how to do it,...
8
by: Brian Tkatch | last post by:
Server: DB2/SUN 8.1.6 Client: DB2 Connect Personal Edition (No 11) <URL:ftp://ftp.software.ibm.com/ps/products/db2/fixes2/english-us/db2winIA32v8/fixpak/FP11_WR21365/FP11_WR21365_CONPE.exe> ...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
2
by: FutureShock | last post by:
I am using a registration class to process a registration form and need some opinions on returning error messages. I am self referring the page on submit. I would like to send each form field...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
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: 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...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.