2008-12-30 111 views

回答

5

您正在嘗試閱讀http標題。

OperationContext.Current.OutgoingMessageProperties 
or 
OperationContext.Current.IncomingMessageProperties 
+0

這不會對WCF服務工作,並拋出我用這個讀取授權報頭異常 – Vincent 2012-11-13 00:32:19

14

其實既然你問了一個基於REST WCF服務,我認爲你應該爲了得到HTTP標頭在請求中使用

WebOperationContext.Current.IncomingRequest.Headers 

+3

: `變種AUTH = WebOperationContext.Current.IncomingRequest.Headers [「授權」];` – 2012-06-15 07:28:35