views:

115

answers:

4

Is there an event log source that's always available for writing by an ASP.NET webapp?

Backstory, in case anyone has a seemingly unrelated solution:

Our ASP.NET webapp uses its own event log source, but it doesn't have the rights to create it. So, if the event log source doesn't exist when the webapp tries to write the entry (install instructions dictate that the admin register the event log source manually, but......) , our webapp doesn't put anything in the event log when it has problems.

I'm hoping there's another (app-agnostic) source I can use to notify the folks who watch the event log.

+2  A: 

You should be able to write to the built-in event logs (Application, Security, System) without much difficulty.

GWLlosa
What would I use as my event source?
lance
Use whatever event source you want. If the source is not registered, the message will be put into the system's built-in "Application" log, but the source will still appear in the actual message.
Remy Lebeau - TeamB
Hmm. For the messages you observe with the source "in the actual message", what value does the Event Log show in the "Source" column?
lance
+1  A: 

Considered email notification? I guess some admins prefer to be notified from their cellphones.

You could also ring home (call a web service to write log back to your own server), in case the client refuse to create a key under HKLM\System\CurrentControlSet\Services\EventLog\

Sheng Jiang 蒋晟
+1  A: 

In this KB article it explains the issue http://support.microsoft.com/kb/329291

If you use the second approach under the resolution you should get it to work.

If you don't want to do that or you can't get it to work correctly another way would be to use the identity tag in your web.config and impersonate a user that does have rights to edit the registry. This is a security whole only for this application but if you implement some extra security measures you should be fine.

Avitus
+1  A: 

You might not have access to create an event source from the web app, but if memory serves, you can check to see if one exists.

In the global.asax or a custom handler, check to see if they created it like they were supposed to. If they didn't, have a really annoying reminder div show on every page. As soon as they create it like they were supposed to, the div goes away :)

Rob
Short of a solid answer to my original question, this is likely what I'll do. Thank you.
lance