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_Err or' subroutine in the
'Global.asax' file
Public Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs)
Dim ErrorDescriptio n As String = Server.GetLastE rror.ToString()
'Creation of event log if it does not exist
Dim EventLogName As String = "ErrorSampl e"
If Not EventLog.source Exists(EventLog Name) Then
' Problem1 Error Message = SourceExists is not a member of
EventLog
EventLog.Create EventSource(Eve ntLogName, EventLogName)
' Problem2 Error Message = CreateEventSour ce is not a member of
EventLog
End If
'Inserting into eventlog
Dim Log As New eventlog()
Log.Source = EventLogName
Log.WriteEntry( ErrorDescriptio n, EventLogEntryTy pe.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 2 2210
Kevin,
There are two problems
1. Error Message = SourceExists is not a member of EventLog at line:
If Not EventLog.source Exists(EventLog Name) Then
2. Error Message = CreateEventSour ce is not a member of EventLog at line:
EventLog.Create EventSource(Eve ntLogName, EventLogName)
The problems were written inline the message :-)
Please help me.
Gary
"Kevin Spencer" <ke***@takempis .com> wrote in message
news:%2******** *********@TK2MS FTNGP09.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****@microso ft.com> wrote in message news:O%******** ********@TK2MSF TNGP12.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_Err or' subroutine in the 'Global.asax' file Public Sub Application_Err or(ByVal sender As Object, ByVal e As
EventArgs) Dim ErrorDescriptio n As String = Server.GetLastE rror.ToString()
'Creation of event log if it does not exist
Dim EventLogName As String = "ErrorSampl e"
If Not EventLog.source Exists(EventLog Name) Then ' Problem1 Error Message = SourceExists is not a member of EventLog
EventLog.Create EventSource(Eve ntLogName, EventLogName) ' Problem2 Error Message = CreateEventSour ce is not a
member of EventLog
End If
'Inserting into eventlog
Dim Log As New eventlog()
Log.Source = EventLogName
Log.WriteEntry( ErrorDescriptio n, EventLogEntryTy pe.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
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.Diagnost ics. Is it there? Another
possibility is that you created an instance of The
System.Diagnost ics.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.Diagnost ics.EventLog.So urceExists(Even tLogName) 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****@microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl... Kevin,
There are two problems 1. Error Message = SourceExists is not a member of EventLog at line: If Not EventLog.source Exists(EventLog Name) Then
2. Error Message = CreateEventSour ce is not a member of EventLog at line: EventLog.Create EventSource(Eve ntLogName, EventLogName)
The problems were written inline the message :-)
Please help me. Gary
"Kevin Spencer" <ke***@takempis .com> wrote in message news:%2******** *********@TK2MS FTNGP09.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****@microso ft.com> wrote in message news:O%******** ********@TK2MSF TNGP12.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_Err or' subroutine in the 'Global.asax' file Public Sub Application_Err or(ByVal sender As Object, ByVal e As EventArgs) Dim ErrorDescriptio n As String = Server.GetLastE rror.ToString()
'Creation of event log if it does not exist
Dim EventLogName As String = "ErrorSampl e"
If Not EventLog.source Exists(EventLog Name) Then ' Problem1 Error Message = SourceExists is not a member of EventLog
EventLog.Create EventSource(Eve ntLogName, EventLogName) ' Problem2 Error Message = CreateEventSour ce is not a member of EventLog
End If
'Inserting into eventlog
Dim Log As New eventlog()
Log.Source = EventLogName
Log.WriteEntry( ErrorDescriptio n, EventLogEntryTy pe.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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 errors and stores them in an array. As things
work right now, I write out each error message individually. I'm
thinking that as the code grows, this system will not continue to
scale. Right now my software consists of 1.4 megs of PHP code. I don't...
|
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?
I got this mysterious error message below in my logs ( nothing visible
|
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, city, state, etc.
When the user wants to search for a particular record, he does two
things:
1. On the form is a text box on which he enters the text he is searching
for.
|
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 VS, however, when I change to
release and put it out on the web it fails giving me the following error
message
The underlying connection was closed. Could not establish a trust
relationship with the remote server.
|
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, where to check it
and how to display a good error message. I would love to hear some
comments about my ideas:
| |
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>
Uninstalled old version, installed new version, and am now trying to
use the CLP.
<<<<<<<<<<<<
For more detailed help, refer to the Online Reference Manual.
|
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 where someone
suggested to me I was spending too much time writing error messages,
and that I was therefore missing the benefit of using a scripting
language. The idea, apparently, is that the PHP interpreter writes all
the error messages that are...
|
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
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 to the class for processing
(validating, sanitizing, etc..) So far no problem.
Now I am throwing ideas around on how best to check for error messages
to the users.
|
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 will be writing this article intended for those who are in the same level, or maybe lower, of my technical knowledge.
I would be using layman's words, or maybe, my own words as how I understand them, hoping, you will understand it the same way that...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |