System.SecurityException error
c#, event-log, system.diagnostics
Solution
I think you must have Admin privilege for creating new EventLog.
Problem
when i compile the following code it shows the error as system.securityexception error. ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.Threading; namespace eventlog { class MySample{ public static void Main(){ if(!EventLog.SourceExists("MySource")) { EventLog.CreateEventSource("MySource", "MyNewLog"); Console.WriteLine("CreatedEventSource"); Console.WriteLine("Exiting, execute the application a second time to use the source."); return; } EventLog myLog = new EventLog(); myLog.Source = "MySource"; myLog.WriteEntry("Writing to event log."); } ``` } } how to fix this error