views:

27

answers:

1

Is it possible to read cookies in the OperationContract of a wcf service? I am trying to read a cookie value in the contract method, but its always empty. If I read the same cookie from a .aspx page, the value is present. Any ideas?

A: 

How are you hosting them? WCF is intended to be host-neutral -- i.e. your services should still work when hosted outside of IIS. However, there is a compatibilty mode which might help you:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
</system.serviceModel>

The default value is false and disables most ASP.NET features like HttpContext.Current.

Kirk Woll