I am trying to read and/or write to the Event Log. I'm upgrading an
existing, working VS2003 VB.NET program to VS2005 and get the error message:
Request for the permission of type 'System.Diagnostics.EventLogPermission,
System, Version=2.0.0.0, Culture=neutral, PublickeyToken=b77a5c561934e089'
failed.
This occurs on the statement 'moEventlog = new Eventlog' in the VB.NET
program. I tried to fix the problem by adding the following lines
immediately before this line:
moEventLogPermission = new
EventLogPermission(EventLogPermissionAccess.Admini ster,".")
moEventLogPermission.Assert()
But this doesn't help at all - I get the exact same error message. Note: I
have 'Imports System.Diagnostics' so that's not the problem.
How can I get my event logging to work again? I know this is a new security
change with Dotnet Framework 2.0. Is there a simple fix?
Thanks,
Tom