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:
http://pranas.net/Tutorials/asp/EventLog.htm (example)

6 Comments:

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 Kaseya.com or GFI.com? 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 http://audiobookscollection.co.uk/Differential-Evolution-A-Practical-Approach-to-Global-Optimization/p147455/ simplified hcg ebook free [url=http://audiobookscollection.co.uk/de/Mac-OS-X-UNIX/c2051/]pappapc ebook torrent[/url] lisa shaffer smart start ebook

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

moral of the story rosenstand ebook http://audiobooksplanet.co.uk/Colin-Read/m22320/ ebook craft of software testing [url=http://audiobooksplanet.co.uk/Books-and-Reading/c1117/?page=2]what's an ebook[/url] rose croix free ebook

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

gps software freeware palm http://buysoftwareonline.co.uk/product-10283/Redfield-Water-Ripples-1-1-for-Adobe-Photoshop what are system software [url=http://buysoftwareonline.co.uk/product-10447/EZ-Backup-IncrediMail-Premium]gpl multitrack software[/url] gas natural software trading
[url=http://buysoftwareonline.co.uk/product-37375/Babylon-Pro-7-0]Babylon Pro 7.0 - Software Store[/url] bit defender plus virus software website
[url=http://buysoftwareonline.co.uk/product-36799/Atop-CHM-to-PDF-Converter-2-0][img]http://buyoem.co.uk/image/4.gif[/img][/url]

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

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

 

Post a Comment

<< Home