8

How can I read Authorization header information from a REST based WCF service?

user27052
  • 375
  • 3
  • 8
  • 12

2 Answers2

14

Actually since you ask for a REST based WCF service I think you should use

WebOperationContext.Current.IncomingRequest.Headers

in order to get the HTTP headers in the request.

Cellfish
  • 2,202
  • 18
  • 20
  • 3
    I used this to read the Authorization header: `var auth = WebOperationContext.Current.IncomingRequest.Headers["Authorization"];` – Nicklas Savonen Jun 15 '12 at 07:28
5

You are trying to read the http header.

OperationContext.Current.OutgoingMessageProperties
or
OperationContext.Current.IncomingMessageProperties
Ray Lu
  • 26,208
  • 12
  • 60
  • 59