September 18, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Writing to the EventLog from a Web Application

  • February 23, 2009
  • By Paul Kimmel
  • Send Email »
  • More Articles »

You can see the value of the event entry by clicking the entry you are interested in and opening the Visual Studio Properties window. You can see the "Test" message for the code in Listing 1 and item in Figure 3 in the Properties window in Figure 4.

Figure 4: The properties of the event entry can be viewed from the Server Explorer and the Properties window.

The downside is that this is a lot more work than calling CreateEventSource. Perhaps it's a small price to pay to further protect your servers, but it is more work. Avoid Registry hacks because these are not generally good practices and your IT administrator or your cloud computing provider will likely not allow this approach.

Summary

Earlier versions of Windows and .NET permitted you to check for and create an event source with a couple of lines of code. As security features are ratcheted down, it will create more work for programmers (in this economy, more work is more better), but the work is sometimes nuisance work. A good strategy is to create an application event source for each application; unfortunately, you will not be able to do this from within your web application. Instead, create a DLL, run the InstallUtil.exe with administrative privileges, and use an installer to create the event source. You only need to do this one time per environment, so it's not that big of a deal, especially if it helps you sleep better at night.

About the Author

Paul Kimmel is the VB Today columnist for www.codeguru.com and has written several books on object-oriented programming and .NET. Check out his book LINQ Unleashed for C#, now available on Amazon.com and at fine bookstores everywhere. Look for his upcoming book Teach Yourself the ADO.NET Entity Framework in 24 Hours. You may contact him for technology questions at pkimmel@softconcepts.com. Paul Kimmel is a Technical Evangelist for Developer Express, Inc.

Copyright © 2009 by Paul T. Kimmel. All Rights Reserved.





Page 3 of 3



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel