System.Web.Http.HttpRequestMessageExtensions.GetHeader C# (CSharp) Method

GetHeader() public static method

Returns an individual HTTP Header value
public static GetHeader ( this request, string key ) : string
request this
key string
return string
        public static string GetHeader( this HttpRequestMessage request, string key )
        {
            IEnumerable<string> keys = null;
            if ( !request.Headers.TryGetValues( key, out keys ) )
                return null;

            return keys.First();
        }