How to add cookie on a HttpTransportBindingElement

后端 未结 3 1339
囚心锁ツ
囚心锁ツ 2021-01-02 23:24

I\'m having a WCF client which communicates with a WCF service (running AspNetCompabilityMode), and I would like to add a cookie

3条回答
  •  太阳男子
    2021-01-03 00:05

    The method described in http://kennyw.com/indigo/153 works on a per-service-call basis. This means you have to make sure all invocations to your WCF service are made after the OperationContextScope object is created and before it is disposed for this to work. Otherwise the cookie will never be added to the request.

    If you are looking for a centralized solution to manually add a cookie to all outgoing HTTP requests made to the WCF service have a look at this thread:

    http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/624fb3f9-222d-4795-9140-fe9ef3934361/

提交回复
热议问题