Try something like this:
IEnumerable<string> headerValues = request.Headers.GetValues("MyCustomID");
var id = headerValues.FirstOrDefault();
There’s also a TryGetValues method on Headers you can use if you’re not always guaranteed to have access to the header.
More Related Contents:
- How to make an HTTP POST web request
- Best practice to call ConfigureAwait for all server-side code
- Entity Framework change connection at runtime
- Specifying a custom DateTime format when serializing with Json.Net
- Best practice to return errors in ASP.NET Web API
- Why should I use IHttpActionResult instead of HttpResponseMessage?
- Web API Put Request generates an Http 405 Method Not Allowed error
- prevent property from being serialized in web API
- How to update a claim in ASP.NET Identity?
- HTTP 404 Page Not Found in Web Api hosted in IIS 7.5
- MVC web api: No ‘Access-Control-Allow-Origin’ header is present on the requested resource
- catch all unhandled exceptions in ASP.NET Web Api
- Suppress properties with null value on ASP.NET Web API
- How to use a client certificate to authenticate and authorize in a Web API
- Webapi formdata upload (to DB) with extra parameters
- Multiple Controller Types with same Route prefix ASP.NET Web Api
- Order of execution with multiple filters in web api
- Manually set operationId to allow multiple operations with the same verb in Swashbuckle
- Asp.net WEB API – What problems could arise if I use POST instead of PUT and DELETE?
- How to return a file using Web API?
- ASP.NET Core v2 (2015) MVC : How to get raw JSON bound to a string without a type?
- Put content in HttpResponseMessage object?
- Could not load file or assembly ‘System.Web.Http 4.0.0 after update from 2012 to 2013
- POST string to ASP.NET Web Api application – returns null
- Why is this web api controller not concurrent?
- Disable *all* exception handling in ASP.NET Web API 2 (to make room for my own)?
- Web API: Configure JSON serializer settings on action or controller level
- How to use caching in ASP.NET Web API?
- Why is an “await Task.Yield()” required for Thread.CurrentPrincipal to flow correctly?
- Using Serializable attribute on Model in WebAPI