I have a WCF service that has methods with the PrincipalPermission attribute on them. When a user that does not have the appropriate permissions tries to access those methods the attribute throws a SecurityException but since the exception is thrown in the attribute it's not possible to put try..chatch around the call.
I have tried using the ExceptionShielding attribute from the Enterprise Library with a logging handler but it does not write any logs. I even tried writing a WCF Behavior extension to try and catch the exception but the extension could not call the exception handling block properly.
Does anyone have a good idea of how to achieve this.