Users Pricing

forum

Home Forums Passing a parameter from request header to the API controller action method – MindStick

Passing a parameter from request header to the API controller action method

Anonymous User 2125 17 Nov 2014

I am using WEB API 2.0 for REST Service development and I need to pass a parameter from request header to the API controller action method. How can I? 

By default API controller is reading the parameters from request body. How can I make it read parameter from request header? 

[HttpPost]
[Route("abc")]
public IHttpActionResult abcMethod(string s)
{
   //some code
}

I want the above abcMethod to read it's parameter from request header.

Pls suggest.


1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md