MSDN > 論壇首頁 > Windows Communication Foundation > Getting _all_ request headers
發問發問
 

已答覆Getting _all_ request headers

  • Thursday, 2 July, 2009 14:40Oliver Salah 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     
    Hi all,


    within my WCF RESTful service I'm trying to get all headers that are part of the according request. WCF provides programmatic acces through WebOperationContext.Current.IncomingWebRequestContext.Headers

    Unfortunately, it doesn't seem to be possible to retrieve the actual request string. One short example of an http request, so you'll understand what I mean:
    GET /index.php?user=johndoe HTTP/1.1
    Host: www.somepage.com
    User-Agent: Mozilla/4.0
    Accept: image/gif, image/jpeg, */*
    Connection: close

    How do I programmatically access the first line, i.e.,
    GET /index.php?user=johndoe HTTP/1.1

    There is WebOperationContext.Current.IncomingWebRequestContext.Method but this does only return "GET", not the string after (which I need to access for some reasons).
    I know that I can specify an UriTemplate and map the according bracket-contens to actual method parameters, but this is not what I need.
    Any ideas? Thank you!


    Best Regards
    Oliver.

解答

所有回覆