Ask a questionAsk a question
 

AnswerGetting _all_ request headers

  • Thursday, July 02, 2009 2:40 PMOliver Salah Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.

Answers

All Replies