开发者

WCF challenge (in AfterReceiveRequest method of IDispatchMessageInspector Interface)

I'm getting some values in AfterReceiveRequest and want to use that in BeforeSendReply in WCF. Please help me, how I can do that. I'm working in C# project files. I can't use Seesion, ViewState here. I can use

static fields, but It will not a good solution. Please give me best solution for this.

Below are some lines of my code.

public object AfterReceiveRequest(

            ref System.ServiceModel.Channels.Message request,

            System.ServiceModel.IClientChannel channel,

            System.ServiceModel.InstanceContext instanceContext)

        {

             ClassABC abc = new ClassABC();         
 int webServiceID = abc .SetInformation(--//any parameters//--);

            return null;

        }


        public void BeforeSendReply(ref System.ServiceModel.Channels.Message reply,

            object correlationState)

        {

           //here I need webS开发者_C百科erviceID.
        }


That's what the correlationState value is for. Basically, whatever object you return from AfterReceiveRequest() will be passed to you again on the correlationState parameter of BeforeSendReply().

Just stick all the info you need into an object and pass it around that way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜