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

Event Logging from ASP.NET

In the past, I remember all kinds of security related issues when trying to
write to the event log but don't remember the specifics. Was there an issue
with creating a new source?

Can you write if you are using the ASP.NET account or Network Services
account? Did this change with .NET v2.0 and/or Win 2003 SP1?
thanks,

Jun 19 '07 #1
15 1494
Ysgrifennodd Andrew Robinson:
In the past, I remember all kinds of security related issues when trying
to write to the event log but don't remember the specifics. Was there an
issue with creating a new source?

Can you write if you are using the ASP.NET account or Network Services
account? Did this change with .NET v2.0 and/or Win 2003 SP1?
thanks,
Yes. My understanding is that you can write to a log that's been
created, but you can't create a new log.

We have a little Windows.Forms app that creates a log with a given name.
ASP.NET and Web service applications can then write to that log.
Whether or not this is the best solution, I have no idea, but it works
for us.

:-)
Peter
Jun 19 '07 #2
"Peter Bradley" <p.*******@dsl.pipex.comwrote in message
news:XM*********************@pipex.net...
Yes. My understanding is that you can write to a log that's been created,
but you can't create a new log.
That's also my understanding...
We have a little Windows.Forms app that creates a log with a given name.
ASP.NET and Web service applications can then write to that log. Whether
or not this is the best solution, I have no idea, but it works for us.
I have something similar...
--
http://www.markrae.net

Jun 19 '07 #3
The "issue" is still there. You can not create new source. But since you do
it only once simply have a desktop program that does it and run it under
Admin account.

Then your ASP.NET will be able to write into event log.

George

"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
In the past, I remember all kinds of security related issues when trying
to write to the event log but don't remember the specifics. Was there an
issue with creating a new source?

Can you write if you are using the ASP.NET account or Network Services
account? Did this change with .NET v2.0 and/or Win 2003 SP1?
thanks,

Jun 19 '07 #4
Are you getting paid for messages?

George

"Mark Rae" <ma**@markNOSPAMrae.netwrote in message
news:uL**************@TK2MSFTNGP06.phx.gbl...
"Peter Bradley" <p.*******@dsl.pipex.comwrote in message
news:XM*********************@pipex.net...
>Yes. My understanding is that you can write to a log that's been
created, but you can't create a new log.

That's also my understanding...
>We have a little Windows.Forms app that creates a log with a given name.
ASP.NET and Web service applications can then write to that log. Whether
or not this is the best solution, I have no idea, but it works for us.

I have something similar...
--
http://www.markrae.net

Jun 19 '07 #5
Ok, if I can't create a new Source and I really don't want to require a user
to first run some type of desktop app, any suggestions on an existing source
that is likely to exist that I can use?

-Andy
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OZ**************@TK2MSFTNGP06.phx.gbl...
The "issue" is still there. You can not create new source. But since you
do it only once simply have a desktop program that does it and run it
under Admin account.

Then your ASP.NET will be able to write into event log.

George

"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl...
>In the past, I remember all kinds of security related issues when trying
to write to the event log but don't remember the specifics. Was there an
issue with creating a new source?

Can you write if you are using the ASP.NET account or Network Services
account? Did this change with .NET v2.0 and/or Win 2003 SP1?
thanks,

Jun 19 '07 #6
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:eu**************@TK2MSFTNGP06.phx.gbl...
Are you getting paid for messages?
No more than you are for top-posting...
--
http://www.markrae.net

Jun 19 '07 #7
Not sure what type of solution you looking for.
New "source" is a simple entry in a registry.
You can
a) created manually
b) create using program that runs under Admin rights.
You choose.

Another option would be not to log into event log and intead send an email
with error info.
That is how all my online application work.

So usually i am there fixing bugs before user called me.

George.


"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Ok, if I can't create a new Source and I really don't want to require a
user to first run some type of desktop app, any suggestions on an existing
source that is likely to exist that I can use?

-Andy
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OZ**************@TK2MSFTNGP06.phx.gbl...
>The "issue" is still there. You can not create new source. But since you
do it only once simply have a desktop program that does it and run it
under Admin account.

Then your ASP.NET will be able to write into event log.

George

"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl. ..
>>In the past, I remember all kinds of security related issues when trying
to write to the event log but don't remember the specifics. Was there an
issue with creating a new source?

Can you write if you are using the ASP.NET account or Network Services
account? Did this change with .NET v2.0 and/or Win 2003 SP1?
thanks,


Jun 19 '07 #8
re:
!any suggestions on an existing source that is likely to exist that I can use?

The Application Event Log is a good candidate.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Ok, if I can't create a new Source and I really don't want to require a user to first run some
type of desktop app, any suggestions on an existing source that is likely to exist that I can use?

-Andy
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OZ**************@TK2MSFTNGP06.phx.gbl...
>The "issue" is still there. You can not create new source. But since you do it only once simply
have a desktop program that does it and run it under Admin account.

Then your ASP.NET will be able to write into event log.

George

"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl. ..
>>In the past, I remember all kinds of security related issues when trying to write to the event
log but don't remember the specifics. Was there an issue with creating a new source?

Can you write if you are using the ASP.NET account or Network Services account? Did this change
with .NET v2.0 and/or Win 2003 SP1?
thanks,


Jun 19 '07 #9
I am afraid you a bit misleading the guy. "Application" Event Log is a name
of the log and not a source.
There are 2 components when writing into even log.

Source and Log Name.

Log Name identifies which event log. "Application", "System".... You can
create your own name and it will be shown in the Even Viewer as a root node.

Then there is a Source of the event. Source basically points to which
application has created that entry in event log. You can see Source as a
column in the event viewer.

So folowing code
if (!EventLog.SourceExists("TEST"))

EventLog.CreateEventSource("TEST", "Application");

EventLog.WriteEntry("TEST", msg, EventLogEntryType.Error);

will create even source TEST connected to event log "Application" and then
write there with source "TEST"

You need to have admin rights to create both new Log (usually "Application"
is used so no need to create it).
and new source.

George.


"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
re:
!any suggestions on an existing source that is likely to exist that I
can use?

The Application Event Log is a good candidate.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>Ok, if I can't create a new Source and I really don't want to require a
user to first run some type of desktop app, any suggestions on an
existing source that is likely to exist that I can use?

-Andy
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OZ**************@TK2MSFTNGP06.phx.gbl...
>>The "issue" is still there. You can not create new source. But since you
do it only once simply have a desktop program that does it and run it
under Admin account.

Then your ASP.NET will be able to write into event log.

George

"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl.. .
In the past, I remember all kinds of security related issues when
trying to write to the event log but don't remember the specifics. Was
there an issue with creating a new source?

Can you write if you are using the ASP.NET account or Network Services
account? Did this change with .NET v2.0 and/or Win 2003 SP1?
thanks,



Jun 19 '07 #10
Ysgrifennodd Andrew Robinson:
Ok, if I can't create a new Source and I really don't want to require a
user to first run some type of desktop app, any suggestions on an
existing source that is likely to exist that I can use?

-Andy
Hang on. You're not trying to do logging on the client, are you? I
think everyone else is talking about the server(s). The "desktop" app
would be run on the Web server(s) as part of the ASP.NET application
install. Put it in an .msi file, if you like, that installs the whole
application.

Since the restriction only applies to Web apps, objects on other servers
- app servers and the like - don't have the problem.

Is there a problem with any of that?
Peter
Jun 19 '07 #11
Good catch Peter.
We could have beaten that cow to death and he's still going to have problem
:)
George

>
Hang on. You're not trying to do logging on the client, are you? I think
everyone else is talking about the server(s). The "desktop" app would be
run on the Web server(s) as part of the ASP.NET application install. Put
it in an .msi file, if you like, that installs the whole application.

Since the restriction only applies to Web apps, objects on other servers -
app servers and the like - don't have the problem.

Is there a problem with any of that?
Peter

Jun 19 '07 #12
Guys,

I have done all kinds of logging in the past and am currently doing
extensive SMTP based logging within the Application_Error event but it looks
very much so like some of my SMTP messages are not making their way back to
my email account. Only a handful are missing and I cannot reproduce any
configuration that causes these to fail. Guessing that they are being
filtered by my clients ISP at certain times of the day?

I was thinking about logging additional info to the even log but don't have
full access to the server and really don't want to go down the path of
adding sources to the registry.

Thanks,

"Peter Bradley" <p.*******@dsl.pipex.comwrote in message
news:5L******************************@pipex.net...
Ysgrifennodd Andrew Robinson:
>Ok, if I can't create a new Source and I really don't want to require a
user to first run some type of desktop app, any suggestions on an
existing source that is likely to exist that I can use?

-Andy

Hang on. You're not trying to do logging on the client, are you? I think
everyone else is talking about the server(s). The "desktop" app would be
run on the Web server(s) as part of the ASP.NET application install. Put
it in an .msi file, if you like, that installs the whole application.

Since the restriction only applies to Web apps, objects on other servers -
app servers and the like - don't have the problem.

Is there a problem with any of that?
Peter
Jun 19 '07 #13
re:
!"Application" Event Log is a name of the log and not a source.

Right you are...

My apologies.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:O5**************@TK2MSFTNGP04.phx.gbl...
>I am afraid you a bit misleading the guy. "Application" Event Log is a name of the log and not a
source.
There are 2 components when writing into even log.

Source and Log Name.

Log Name identifies which event log. "Application", "System".... You can create your own name and
it will be shown in the Even Viewer as a root node.

Then there is a Source of the event. Source basically points to which application has created that
entry in event log. You can see Source as a column in the event viewer.

So folowing code
if (!EventLog.SourceExists("TEST"))

EventLog.CreateEventSource("TEST", "Application");

EventLog.WriteEntry("TEST", msg, EventLogEntryType.Error);

will create even source TEST connected to event log "Application" and then write there with source
"TEST"

You need to have admin rights to create both new Log (usually "Application" is used so no need to
create it).
and new source.

George.


"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>re:
!any suggestions on an existing source that is likely to exist that I can use?

The Application Event Log is a good candidate.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>>Ok, if I can't create a new Source and I really don't want to require a user to first run some
type of desktop app, any suggestions on an existing source that is likely to exist that I can
use?

-Andy
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:OZ**************@TK2MSFTNGP06.phx.gbl...
The "issue" is still there. You can not create new source. But since you do it only once simply
have a desktop program that does it and run it under Admin account.

Then your ASP.NET will be able to write into event log.

George

"Andrew Robinson" <ne****@nospam.nospamwrote in message
news:%2******************@TK2MSFTNGP03.phx.gbl. ..
In the past, I remember all kinds of security related issues when trying to write to the event
log but don't remember the specifics. Was there an issue with creating a new source?
>
Can you write if you are using the ASP.NET account or Network Services account? Did this
change with .NET v2.0 and/or Win 2003 SP1?
>
>
thanks,



Jun 19 '07 #14
Hi Andrew,

The original problem is due to ASP.NET default process identity(default
permission) can not create a custom/new event source. But the default
identity should be able to write into the "Application" Event source
without any problem. Here is the original KB article:

#PRB: "Requested Registry Access Is Not Allowed" Error Message When ASP.NET
Application Tries to Write New EventSource in the EventLog
http://support.microsoft.com/kb/329291

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 20 '07 #15
Hi Andrew,

Does the kb article and the information in previous message what you want?
If there is anything else need help, please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
Jun 25 '07 #16

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

Similar topics

2
by: ETL | last post by:
Hi, I think this question has an easy answer but I can't seem to find anything online that lists best practices for my problem. I have a C# app that uses an exception handling tree similar to...
3
by: Sal Young | last post by:
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...
29
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ...
0
by: Tom Wingert | last post by:
Hi, I am having a problem with getting My.Log.WriteException to write to the Event Log in ASP.Net 2.0 with a web service. When an error occurs, My.Log.WriteException doesn't log anything to the...
5
by: news.microsoft.com | last post by:
We are logging many events on our application but cant seem to discover how to determine who the user was in the session end event, as any session storage seems to have disapeared at the point at...
0
by: Eniac | last post by:
Hello, I've started using Enterprise Library 2.0 recently and I've encountered a problem that seems to be ... well... undocumented :) Basically, when I set a Trace Listener (formatted event...
6
by: JeffDotNet | last post by:
Writing to a registered source in the Application event log I have an asp.net framework 2.0 app that I created on a winxp machine and now I am deploying it to IIS6 on a win server2003 machine. ...
0
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Hi, Thanks in advance for reading this. Not sure where to post this question, but I hope someone in here can help. Trying to write to Event Log in VS 2005 (.NET 2.0) using Enterprise Library...
10
by: jaleel | last post by:
Hi , i would like to reopen the issue in the post http://www.gamedev.net/community/forums/topic.asp?topic_id=418791. My scenario is like this: 1. A web application is there (being created by...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
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,...
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...
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,...
0
isladogs
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...

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.