View Single Post
  #1 (permalink)  
Old December 4th, 2003, 02:21 PM
s_vermani s_vermani is offline
Registered User
Join Date: Dec 2003
Location: Schaumburg, IL, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Security exception comes when writing to event log

I am trying to write to event log. When I run it I get a Security Exception message shown below. I am using windowsXP Pro and have administrator rights.

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Requested registry access is not allowed.

Source Error:

Line 16: string LogName = "MyApplicationLog";
Line 17: string SourceName = "MyApplicationSource";
Line 18: if(!(EventLog.SourceExists(SourceName)))
Line 19: {
Line 20: EventLog.CreateEventSource(SourceName, LogName);

I read it on this forum that this can be fixed by changing the appEvent.evt file's security setting but I am not able to see the security tab for AppEvent.evt file. Please advice.