提出问题提出问题
 

已答复Getting _all_ request headers

  • 2009年7月2日 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.

答案

全部回复