Reading cookie from WCF RESTful web service

Writing an IIS suite for WCF web services (both GET and POST) and I need to be able to read cookies for an authentication token, so I know that the user was previously there.

Will HttpContext.Current.Cookies give me what I need, or is there something cleaner and more suitable for WCF web service with WebGet and WebInvoke attributes?

+3
source share
1 answer
string cookieHeader = WebOperationContext.Current.IncomingRequest.Headers[HttpRequestHeader.Cookie];

works for me

+4
source

Source: https://habr.com/ru/post/1712157/


All Articles