Click here to Skip to main content
15,881,803 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have requirement like before calling a wcf service method I have to check the session.if the session exists then only I will call that service method.

For that I am using WCF extensibility and Implementing "IOperationInvoker" interface

Here in Invoke() method of "IOperationInvoker" interface I am checking the session
if the session does not exists then I am throwing an 403 exception but in the web it is showing 500 internal server error.


C++
public object Invoke(object instance, object[] inputs, out object[] outputs)
         {
             //---checking for session
             ----code for checking session--- 

             if (isSessionExist)
             {
                 return originalInvoker.Invoke(instance, inputs, out outputs);
             }
             else
             {
                 throw new System.ServiceModel.Web.WebFaultException
                                               (System.Net.HttpStatusCode.Unauthorized);
             }
         }



when I am not throwing 403 exception then there is no 500 exception.
Posted
Updated 18-Sep-13 2:20am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900