Monday, April 23, 2007

Writing into Event Log from an ASP.NET application

If you try to write an entry to events log form an ASP.NET application is probably that you find an exception like this "The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.". The reason is that the ASP.NET process cannot find the source of the entry. You have to create it manually because, by default, the ASP.NET process, cannot do it programmatically. To create it manually you have to add a new entry in the registry (regedit.exe) with the name of your source (in the example TEST under Application log) in the following path "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application". Then, with the following code, you can write your entries.

string sSource;
string sEvent;
sSource = "TEST";
sLog = "Application";
sEvent = "Sample Event";
EventLog.WriteEntry(sSource, sEvent);

Related Links: (example)


At 10:53 PM, Anonymous Caroline said...

Well written article.

At 6:52 AM, Anonymous Anonymous said...

Can anyone recommend the robust Network Management program for a small IT service company like mine? Does anyone use or How do they compare to these guys I found recently: N-able N-central change management
? What is your best take in cost vs performance among those three? I need a good advice please... Thanks in advance!

At 10:53 PM, Anonymous Anonymous said...

ebook applied physics in radiation oncology simplified hcg ebook free [url=]pappapc ebook torrent[/url] lisa shaffer smart start ebook

At 11:17 PM, Anonymous Anonymous said...

moral of the story rosenstand ebook ebook craft of software testing [url=]what's an ebook[/url] rose croix free ebook

At 8:02 AM, Anonymous Anonymous said...

gps software freeware palm what are system software [url=]gpl multitrack software[/url] gas natural software trading
[url=]Babylon Pro 7.0 - Software Store[/url] bit defender plus virus software website

At 11:03 PM, Anonymous Anonymous said...

free new best dating sites sytycd jeanette manrara dating jason
anti motivational posters dating [url=]p nk and george clooney dating[/url] dads rules for dating
free dating for women in uk [url=]is max still dating erin andrews[/url] jeremiah shapero hb dating sites [url=]karmahbaby2002[/url] dating a drug addict


Post a Comment

<< Home