Argos
Phil's CRM Blog | EventLog.WriteEntry() Permissions issue

EventLog.WriteEntry() Permissions issue

by Phil Adams 12. March 2009 14:47
void Page_Error (object sender, EventArgs e) {
string errorMessage = "Error Occurred:" + Server.GetLastError(); 
Server.ClearError();
if (!(EventLog.SourceExists("myWebApp",".")))
EventLog.CreateEventSource("myWebApp","System",".");
EventLogPermission eventLogPerm = new EventLogPermission(EventLogPermissionAccess.Administer,"."); 
eventLogPerm.PermitOnly();
EventLog evLog = new EventLog();
evLog.Source = "myWebApp";
evLog.WriteEntry(errorMessage, EventLogEntryType.Error); evLog.Close();
}

Tags: , ,

ASP.Net | CRM | CRM Plugin | MSCRM | mscrm4

Add comment




  Country flag

biuquote
  • Comment
  • Preview
Loading



About Phil

Phil has been working with CRM since the BETA of CRM v1.0 and has seen a lot of the problems arising from installation, maintenance and Development.

Phil specializes in the ISV area of CRM; Creating Add-Ons and Plugins for various clients.

Phil currently works as a Microsoft Dynamics CRM Consultant and Developer for Cambridge Online Systems Ltd In the UK.

Phil also has several Microsoft Certifications in .NET and CRM