Error handling in Custom Authorization http://forums.asp.net/t/1801063.aspx/1?Error+handling+in+Custom+Authorization+Mon, 14 May 2012 08:48:53 -040018010634969469http://forums.asp.net/p/1801063/4969469.aspx/1?Error+handling+in+Custom+Authorization+Error handling in Custom Authorization <p>Hi to All,</p> <p>I implemented custom Authorization in WCF service like this</p> <pre class="prettyprint">public class MyAuthorizationManager : ServiceAuthorizationManager { protected override bool CheckAccessCore( OperationContext operationContext) { //something return true; //other something return false; } }</pre> <p>also in added the required configuration in web.config.</p> <p>all woks fine, but i dont know how to handle the exception when the request its not Authorized, so whenever somethig wrong occurs a &quot;not at all look alike my application screen&quot; is showed!</p> <p>anyone can help me on how to handle this?</p> <p>thanks!</p> <p><br> <br> </p> <p></p> 2012-05-07T16:06:20-04:004977647http://forums.asp.net/p/1801063/4977647.aspx/1?Re+Error+handling+in+Custom+Authorization+Re: Error handling in Custom Authorization <p>If the CheckAccessCore method return false, it simply translates into the infrastructure throwing an exception. That exception is a FaultException that represents a sender fault for failing to properly authenticate. You can throw your own fault exception rather than true or false.</p> 2012-05-12T10:07:44-04:004979311http://forums.asp.net/p/1801063/4979311.aspx/1?Re+Error+handling+in+Custom+Authorization+Re: Error handling in Custom Authorization <p>Hi</p> <p>thks for your answer!</p> <p>what I read about this issue, is that the infrastructure after receiving false from this method, it also throws an exception.</p> <p>I solved this by implementing IErroHandler and treating the exception at my will!</p> <p>Love WCF extensibility ! :)</p> 2012-05-14T08:48:53-04:00