How to read raw http request in ASP.NET MVC ?

19. August 2014

How to read raw http request in ASP.NET MVC ?

Below are the codes you can use to read the raw request in parts .

Read the Request Headers :

string originalHeader = HttpHandler.Request.ServerVariables["ALL_RAW"];

For reference http://stackoverflow.com/questions/1038466/logging-raw-http-request-response-in-asp-net-mvc-iis7

Read the Request body :

Request.InputStream.Position = 0;
var input = new StreamReader(Request.InputStream).ReadToEnd();

For reference http://stackoverflow.com/questions/12696506/getting-the-raw-request-in-mvc3

ASP.NET MVC , , , ,

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading