aspnet-core ,

ASP.NET Core - Handling Custom Header on Request/Response

Abhith Rajan Abhith Rajan FollowApril 25, 2019 · 1 min read · Last Updated:
Share this

You can access the request headers or modify the response headers easily inside the controller in your ASP.NET Core applications.

Table of Contents

Add custom hader to response

 Response.Headers.Add("your-custom-header-id", custom_header_value);

Read a request header

 var yourHeader = Request.Headers["your-custom-header-id"].FirstOrDefault();
Abhith Rajan
Written by Abhith Rajan FollowBuy me a coffee
Abhith Rajan is an aspiring software engineer with more than 6 years of experience and proven successful track record of delivering technology-based products and services.