.NET : How to set user information in an EventLog Entry?
The System.Diagnostics.EventLog class provides a way to interact with a windows event log. I use it all the time for simple logging... System.Diagnostics.EventLog.WriteEntry("MyEventSource", "My Special Message") Is there a way to set the user information in the resulting event log entry using .NET? Toughie ... I looked for a way to fill the user field with a .NET method. Unfortunately there is none, and you must import the plain old Win32 API [ReportEvent function]( http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx) with a DLLImportAttribute You must also redeclare the function