title: System.SecurityException error
body: <p>when i compile the following code it shows the error as system.securityexception error.</p>
  
  <pre><code>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.");
  
  }
  </code></pre>
  
  <p>}
          }</p>
  
  <p>how to fix this error</p>