Direct access to raw HTTP Request payload RRS feed


All replies

  • User-943250815 posted

    To me is not clear what is your goal.
    But with info provided I thing if: 
    1) You are receiving multiple requests;
    2) You are getting requests and relaying to another place;
     In both cases your server should return HTTP 200 OK , or any other HTTP code

    By link provided, you infer on Content Response and have access to many other properties of Context.

    On the other hand if your scenario is like a Relay Request, here you have to use HttpWebRequest then on HttpWebResponse you can get all Stream and many more  properties.

    This all I can comment about for now

    Tuesday, January 29, 2019 11:03 PM
  • User1984609290 posted

    Thank very much, jzero, for your response. My goal is to respond HTTP 200 OK as quickly as possible regardless the size of the HTTP Request payload. The bytes of the HTTP Request payload might be stored for later out-of-band processing. The quick HTTP 200 OK response is not related at all to the outcome of such out-of-band processing.

    Tuesday, January 29, 2019 11:14 PM
  • User-943250815 posted

    It seems we are not going anywhere..... But a short answer could be:
    1) Get request;
    2) Start a Background Task;
    3) Return a page with "Hello World"

    Is this quickly enough?

    Wednesday, January 30, 2019 7:58 PM
  • User475983607 posted

    Question: Which part of ASP.NET or ASP.NET Core give us direct access to the raw HTTP Request payload or HttpContext instance (before any other application-level processing, like deserialization of the payload)?

    The Http Pipeline.

    ASP.NET is very mature and there is a lot of openly published documentation on the subject.  In ASP.NET the Global.asax has access to the request through various event handlers like the Application_BeginRequest handler

    The IHttpHandlers allows you to write custom handler.  Then register the handlers in the web.config.



    OWIN (Open Web Interface for .NET) is newer ASP.NET interface for developing Http pipeline services for .NET


    ASP.NET Core has excellent docs.  Middleware is how to access the HTTP pipeline,  See the Core Fundamental docs.  


    Keep in mind, ASp.NET Core designed for speed.  The Request is read once so you need to write a little code to bypass this feature.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 30, 2019 9:50 PM
  • User1984609290 posted

    Thank you very much, jzero, for your response. There is no 'page' in the initial posted scenario, so your point 3) makes no sense. But, point 2) is a very good point that is currently in evaluation already. The initial question is all about your point 1); how to get direct access to the raw HTTP Request payload before any processing on that payload.

    Best regards.

    Thursday, January 31, 2019 2:37 PM
  • User1984609290 posted

    Thank you very much, mgebhard, for your response. I'll take a look at those options.

    Best regards.

    Thursday, January 31, 2019 2:43 PM