Showing posts with label IAction Method. Show all posts
Showing posts with label IAction Method. Show all posts

11 January 2022

How to Add Custom header at IAction method in Asp.net Core

 [HttpGet]

[Route("GetStudents")]

public IActionResult GetAllStudents()

{

var obj = new Student

{

Name = "Adi",

Id = 1

};

HttpContext.Response.Headers.Add("x-custom-header-from-action 1", "my custom value 1");

return Ok(obj);

}