473,385 Members | 1,661 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.

Writing to the EventLog

I have some code that correctly writes to the eventlog on my local machine.
I have installed the application on the Live server and all is not well, no
event log entries.

My development box config is as follows:

Windows XP Pro running IIS 5.1
Web app using integrated auth using a local user account
Account has admin right over machine.
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
On the Server:
Windows 2003 Server running IIS 6
Web app using integrated auth using a Active Directory account
Account is Domain admin
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp

my code is as follows:

Web.Config
<add key="eventlogname" value="MyApp" />

Global.asax.cs
protected void Application_Error(Object sender, EventArgs e)
{
string _message = "\nError in Path :" + Request.Path ; //Get the path of the
page
_message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the QueryString
along with the Virtual Path
_message += "\n\nRequest from :" + Request.UserHostAddress;
_message += "\n\nError Message :" +
ConquestException.HandleConquestException(Server.G etLastError(), false);
System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
//Create a new EventLog object
myLog.Source =
Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]); //Set
the name of the Log
myLog.WriteEntry(_message,
System.Diagnostics.EventLogEntryType.Error);//Write the log
Server.Transfer("~/MyAppError.aspx");
}

I would really appreciate any help you can give me.

MattC
Nov 18 '05 #1
6 1695
Any ideas, anyone? :S

"MattC" <m@m.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
I have some code that correctly writes to the eventlog on my local machine. I have installed the application on the Live server and all is not well, no event log entries.

My development box config is as follows:

Windows XP Pro running IIS 5.1
Web app using integrated auth using a local user account
Account has admin right over machine.
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
On the Server:
Windows 2003 Server running IIS 6
Web app using integrated auth using a Active Directory account
Account is Domain admin
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp

my code is as follows:

Web.Config
<add key="eventlogname" value="MyApp" />

Global.asax.cs
protected void Application_Error(Object sender, EventArgs e)
{
string _message = "\nError in Path :" + Request.Path ; //Get the path of the page
_message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the QueryString
along with the Virtual Path
_message += "\n\nRequest from :" + Request.UserHostAddress;
_message += "\n\nError Message :" +
ConquestException.HandleConquestException(Server.G etLastError(), false);
System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
//Create a new EventLog object
myLog.Source =
Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]); //Set
the name of the Log
myLog.WriteEntry(_message,
System.Diagnostics.EventLogEntryType.Error);//Write the log
Server.Transfer("~/MyAppError.aspx");
}

I would really appreciate any help you can give me.

MattC

Nov 18 '05 #2
Hi MattC:

Try using the following wrapper:

Remotable WMP Player Wrapper for C#
http://www.gotdotnet.com/Community/U...6-49006903e483

This allows you to manipulate and access an out of process media
player instance.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 14:00:03 +0100, "MattC" <m@m.com> wrote:
Any ideas, anyone? :S

"MattC" <m@m.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
I have some code that correctly writes to the eventlog on my local

machine.
I have installed the application on the Live server and all is not well,

no
event log entries.

My development box config is as follows:

Windows XP Pro running IIS 5.1
Web app using integrated auth using a local user account
Account has admin right over machine.
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
On the Server:
Windows 2003 Server running IIS 6
Web app using integrated auth using a Active Directory account
Account is Domain admin
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp

my code is as follows:

Web.Config
<add key="eventlogname" value="MyApp" />

Global.asax.cs
protected void Application_Error(Object sender, EventArgs e)
{
string _message = "\nError in Path :" + Request.Path ; //Get the path of

the
page
_message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the QueryString
along with the Virtual Path
_message += "\n\nRequest from :" + Request.UserHostAddress;
_message += "\n\nError Message :" +
ConquestException.HandleConquestException(Server.G etLastError(), false);
System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
//Create a new EventLog object
myLog.Source =
Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]); //Set
the name of the Log
myLog.WriteEntry(_message,
System.Diagnostics.EventLogEntryType.Error);//Write the log
Server.Transfer("~/MyAppError.aspx");
}

I would really appreciate any help you can give me.

MattC


Nov 18 '05 #3
Hi again Matt:

Apologies for the last message. Little bit of a mixup in the trusty 10
year old newsreader software here.

It looks as if everything is setup correctly. I was going to do an
experiment to make sure the identity is still impersonated when the
control reaches Application_Error, I can get back to you on that.
9/10 this is related to a permissions issue.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 14:00:03 +0100, "MattC" <m@m.com> wrote:
Any ideas, anyone? :S

"MattC" <m@m.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
I have some code that correctly writes to the eventlog on my local

machine.
I have installed the application on the Live server and all is not well,

no
event log entries.

My development box config is as follows:

Windows XP Pro running IIS 5.1
Web app using integrated auth using a local user account
Account has admin right over machine.
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
On the Server:
Windows 2003 Server running IIS 6
Web app using integrated auth using a Active Directory account
Account is Domain admin
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp

my code is as follows:

Web.Config
<add key="eventlogname" value="MyApp" />

Global.asax.cs
protected void Application_Error(Object sender, EventArgs e)
{
string _message = "\nError in Path :" + Request.Path ; //Get the path of

the
page
_message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the QueryString
along with the Virtual Path
_message += "\n\nRequest from :" + Request.UserHostAddress;
_message += "\n\nError Message :" +
ConquestException.HandleConquestException(Server.G etLastError(), false);
System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
//Create a new EventLog object
myLog.Source =
Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]); //Set
the name of the Log
myLog.WriteEntry(_message,
System.Diagnostics.EventLogEntryType.Error);//Write the log
Server.Transfer("~/MyAppError.aspx");
}

I would really appreciate any help you can give me.

MattC


Nov 18 '05 #4
Thanks Scott, I know its slightly off topic but what permission level is
require by the impersonating user on Windows 2003 Svr to write to the event
log.

Also why does my failure to write not cause AST.NET to write and event
stating the failure?

TIA

MattC
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:17********************************@4ax.com...
Hi again Matt:

Apologies for the last message. Little bit of a mixup in the trusty 10
year old newsreader software here.

It looks as if everything is setup correctly. I was going to do an
experiment to make sure the identity is still impersonated when the
control reaches Application_Error, I can get back to you on that.
9/10 this is related to a permissions issue.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 14:00:03 +0100, "MattC" <m@m.com> wrote:
Any ideas, anyone? :S

"MattC" <m@m.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
I have some code that correctly writes to the eventlog on my local

machine.
I have installed the application on the Live server and all is not well,
no
event log entries.

My development box config is as follows:

Windows XP Pro running IIS 5.1
Web app using integrated auth using a local user account
Account has admin right over machine.
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
On the Server:
Windows 2003 Server running IIS 6
Web app using integrated auth using a Active Directory account
Account is Domain admin
Entry has been placed in registry in
\HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp

my code is as follows:

Web.Config
<add key="eventlogname" value="MyApp" />

Global.asax.cs
protected void Application_Error(Object sender, EventArgs e)
{
string _message = "\nError in Path :" + Request.Path ; //Get the path
ofthe
page
_message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the

QueryString along with the Virtual Path
_message += "\n\nRequest from :" + Request.UserHostAddress;
_message += "\n\nError Message :" +
ConquestException.HandleConquestException(Server.G etLastError(), false); System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
//Create a new EventLog object
myLog.Source =
Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]); //Set the name of the Log
myLog.WriteEntry(_message,
System.Diagnostics.EventLogEntryType.Error);//Write the log
Server.Transfer("~/MyAppError.aspx");
}

I would really appreciate any help you can give me.

MattC

Nov 18 '05 #5
We are experiencing the same problem. I would like to measure the efficiency
of this forum by seeing a reply even if it took more than 2 business days as
promised...

TIA -a large customer of yours

"MattC" wrote:
Thanks Scott, I know its slightly off topic but what permission level is
require by the impersonating user on Windows 2003 Svr to write to the event
log.

Also why does my failure to write not cause AST.NET to write and event
stating the failure?

TIA

MattC
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:17********************************@4ax.com...
Hi again Matt:

Apologies for the last message. Little bit of a mixup in the trusty 10
year old newsreader software here.

It looks as if everything is setup correctly. I was going to do an
experiment to make sure the identity is still impersonated when the
control reaches Application_Error, I can get back to you on that.
9/10 this is related to a permissions issue.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 14:00:03 +0100, "MattC" <m@m.com> wrote:
Any ideas, anyone? :S

"MattC" <m@m.com> wrote in message
news:eH**************@TK2MSFTNGP09.phx.gbl...
> I have some code that correctly writes to the eventlog on my local
machine.
> I have installed the application on the Live server and all is not well,no
> event log entries.
>
> My development box config is as follows:
>
> Windows XP Pro running IIS 5.1
> Web app using integrated auth using a local user account
> Account has admin right over machine.
> Entry has been placed in registry in
> \HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
>
>
> On the Server:
> Windows 2003 Server running IIS 6
> Web app using integrated auth using a Active Directory account
> Account is Domain admin
> Entry has been placed in registry in
> \HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
>
> my code is as follows:
>
> Web.Config
> <add key="eventlogname" value="MyApp" />
>
> Global.asax.cs
> protected void Application_Error(Object sender, EventArgs e)
> {
> string _message = "\nError in Path :" + Request.Path ; //Get the path ofthe
> page
> _message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the QueryString> along with the Virtual Path
> _message += "\n\nRequest from :" + Request.UserHostAddress;
> _message += "\n\nError Message :" +
> ConquestException.HandleConquestException(Server.G etLastError(), false);> System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
> //Create a new EventLog object
> myLog.Source =
> Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]); //Set> the name of the Log
> myLog.WriteEntry(_message,
> System.Diagnostics.EventLogEntryType.Error);//Write the log
> Server.Transfer("~/MyAppError.aspx");
> }
>
> I would really appreciate any help you can give me.
>
> MattC
>
>


Nov 18 '05 #6
I can tell you what has been working for me, which is to use REGEDT32
and navigating to HKEY_LOCAL_MACHINE\SYSTEM then
CurrentControlSet\Services\Eventlog. At this point REGEDT32 has a
Security menu you can click on to assign permissions. Giving the
ASPNET process account full control will allow a web app to write to
the event logs (try to be a little more granular than the entire event
log though).

The problem with impersonation is that you'll need to add the
impersonation accounts here, unless you RevertToSelf before writing.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 2 Nov 2004 12:49:03 -0800, "Francois"
<Fr******@community.nospam> wrote:
We are experiencing the same problem. I would like to measure the efficiency
of this forum by seeing a reply even if it took more than 2 business days as
promised...

TIA -a large customer of yours

"MattC" wrote:
Thanks Scott, I know its slightly off topic but what permission level is
require by the impersonating user on Windows 2003 Svr to write to the event
log.

Also why does my failure to write not cause AST.NET to write and event
stating the failure?

TIA

MattC
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:17********************************@4ax.com...
> Hi again Matt:
>
> Apologies for the last message. Little bit of a mixup in the trusty 10
> year old newsreader software here.
>
> It looks as if everything is setup correctly. I was going to do an
> experiment to make sure the identity is still impersonated when the
> control reaches Application_Error, I can get back to you on that.
> 9/10 this is related to a permissions issue.
>
> --
> Scott
> http://www.OdeToCode.com/blogs/scott/
>
> On Wed, 27 Oct 2004 14:00:03 +0100, "MattC" <m@m.com> wrote:
>
> >Any ideas, anyone? :S
> >
> >"MattC" <m@m.com> wrote in message
> >news:eH**************@TK2MSFTNGP09.phx.gbl...
> >> I have some code that correctly writes to the eventlog on my local
> >machine.
> >> I have installed the application on the Live server and all is not

well,
> >no
> >> event log entries.
> >>
> >> My development box config is as follows:
> >>
> >> Windows XP Pro running IIS 5.1
> >> Web app using integrated auth using a local user account
> >> Account has admin right over machine.
> >> Entry has been placed in registry in
> >> \HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
> >>
> >>
> >> On the Server:
> >> Windows 2003 Server running IIS 6
> >> Web app using integrated auth using a Active Directory account
> >> Account is Domain admin
> >> Entry has been placed in registry in
> >> \HKLM\System\CurrentControlSet\Services\EventLog\A pplication\MyApp
> >>
> >> my code is as follows:
> >>
> >> Web.Config
> >> <add key="eventlogname" value="MyApp" />
> >>
> >> Global.asax.cs
> >> protected void Application_Error(Object sender, EventArgs e)
> >> {
> >> string _message = "\nError in Path :" + Request.Path ; //Get the path

of
> >the
> >> page
> >> _message += "\n\nError Raw Url :" + Request.RawUrl ; //Get the

QueryString
> >> along with the Virtual Path
> >> _message += "\n\nRequest from :" + Request.UserHostAddress;
> >> _message += "\n\nError Message :" +
> >> ConquestException.HandleConquestException(Server.G etLastError(),

false);
> >> System.Diagnostics.EventLog myLog = new System.Diagnostics.EventLog();
> >> //Create a new EventLog object
> >> myLog.Source =
> >> Convert.ToString(ConfigurationSettings.AppSettings["eventlogname"]);

//Set
> >> the name of the Log
> >> myLog.WriteEntry(_message,
> >> System.Diagnostics.EventLogEntryType.Error);//Write the log
> >> Server.Transfer("~/MyAppError.aspx");
> >> }
> >>
> >> I would really appreciate any help you can give me.
> >>
> >> MattC
> >>
> >>
> >
>



Nov 18 '05 #7

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

Similar topics

0
by: Jacob Colding | last post by:
Hello, I have created a a logging mechanism, that writes mesages to a custom event log. On each check it verifies whether the requested source is registered to the "IPS" log. If not, it changes...
2
by: Scott Vercuski | last post by:
Everyone, I'm having trouble writing an event to the event log. Here is the chunk of code I currently have. ----------------------------------------------------------------------- Private...
5
by: David Conorozzo | last post by:
I am able to create new sources using CreateEventSource. I can call GetEventLogs, I can delete sources, I can see if sources exist BUT, as soon as I try a "WriteEntry", I get an exception: ...
2
by: Marauderz | last post by:
OK this just seems to be a common question being asked around here, I've tried Google Grouping the question but I still haven't came up with a solution yet. So here goes... I'm getting the...
2
by: MattB | last post by:
I'm writing some code to log errors in a web app (vb/asp.net). I found a straightforward-looking example here: http://www.c-sharpcorner.com/Code/2002/May/CustomErrorHandlingASPNEt.asp But mine...
0
by: Karthik Srinivasan | last post by:
Hi, My web application which runs on Windows 2003 server writes to EventLog during application startup but I get the following exception Requested registry access is not allowed. at...
9
by: Jerry C | last post by:
I am trying to write to the errorlog and I am getting the error Cannot open log for source 'Application'. You may not have write access. This is the code: Dim Logevent As New...
10
by: David Thielen | last post by:
Hi; I am trying to write to the event log using: public const string EVENT_LOG_NAME = "Windward Portal"; if (!EventLog.SourceExists(EVENT_LOG_NAME)) EventLog.CreateEventSource(EVENT_LOG_NAME,...
2
by: =?Utf-8?B?REo=?= | last post by:
I've created a new EventLog for mail services in my web application. Each time a mail is sent, it is recorded in the eventlog for later review. This works fine when I am on my development machine...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: 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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.