I have an ASP .Net app running on a windows 2003 server. If the application throws an exception I want the exception to be written to the event log. I have this implemented but when an exception is thrown I get a security exception because the server does not have permissions to write to the event log.

How do I enable this application permissions to write to the event log?

link|improve this question

75% accept rate
feedback

1 Answer

up vote 1 down vote accepted

Check out the EventLogPermission attribute.

link|improve this answer
Where might I find that attribute? – Pieces Jul 12 '10 at 4:09
See the discussion at secnewsgroups.net/dotnet/… As I understand it, the security settings of the assembly trying to add entries to the log doesn't have sufficient privileges to execute. Specifically, in order to write to the Event Log, your assembly must be granted the EventLogPermission attribute. If your assembly is only partially trusted then this will occur. You need to know Code Access Security to understand this. You may be better off creating your own independent log file to track exceptions thrown by your code. – minerj Jul 15 '10 at 19:03
Cool thank you! – Pieces Jul 21 '10 at 14:12
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.