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

by Abhith RajanApril 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

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

Read a request header

1var yourHeader = Request.Headers["your-custom-header-id"].FirstOrDefault();

This page is open source. Noticed a typo? Or something unclear?
Improve this page on GitHub

Abhith Rajan

Written by Abhith Rajan Buy 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.

Related Videos

Related Stories