I was using .NET 4.0 VS10. I had working WCF services that were using forms authentication. I upgraded to VS11, .NET 4.5.
Now my HttpContext.Current.User is null, in a wcf request. I injected a cookie from login to this request.
HttpRequestMessageProperty httpRequest;
...
httpRequest.Headers.Add(HttpRequestHeader.Cookie, cookie);
Any ideas how to make it work again?
Already have the
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
and the
[AspNetCompatibilityRequirements(RequirementsMode = spNetCompatibilityRequirementsMode.Required)]
If you are running into this issue in an Oneway (operations marked with [OperationContract(IsOneWay=true)]) WCF operation contract, here is the reason for the issue. HttpContext is an asp.net construct. After a one way operation is successfully invoked the service model sends back a 202 (Accepted) reply back to the client.
Since we found a few customer reports on this, a quirked fix is made in .net 4.5.1 update. To give more details about the fix:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With