title: How to get input parameters from HttpRequestMessage
body: <p>I have created a class that inherit from DelegatingHandler and overwrite the SendAsync method. I wanted to validate the request parameters and encode them with AntiXss class before passing it to the main controller. Therefore, I created this. Now when I call the respective controller via SoapUI, I successfully get into the <strong>Async</strong> method and gets the request object. </p>
  
  <p><strong>Difficulty</strong>
  I am not able to fetch the request parameters from the <strong>HTTPREQUESTMESSAGE</strong> object that I passed from the soap ui. Below is the snapshot of the request</p>
  
  <p><a href="https://i.stack.imgur.com/UMTNQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UMTNQ.png" alt="enter image description here"></a></p>
  
  <p><strong>CODE</strong></p>
  
  <pre><code>protected override System.Threading.Tasks.Task&lt;System.Net.Http.HttpResponseMessage&gt; SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken)
      {
          //Encode here the request object 
          var requestObj= request.GetQueryNameValuePairs()
                     .ToDictionary(kv =&gt; kv.Key, kv =&gt; kv.Value,
                          StringComparer.OrdinalIgnoreCase);
          // work on the request
          System.Diagnostics.Trace.WriteLine(request.RequestUri.ToString());
  
          return base.SendAsync(requestObj, cancellationToken)
           .ContinueWith(task =&gt;
           {
             // work on the response
             var response = task.Result;
               response.Headers.Add("X-Dummy-Header", Guid.NewGuid().ToString());
               return response;
           });
      }
  
      #endregion
  }
  </code></pre>
  
  <p>I just wanted to get the values of the parameters that I passed from the SOAP UI under the object of the HTTPRequestMessage. But not succeeded till now. Any help is appreciated.</p>