WebAPi 获取请求头中对应键值
1、枚举类型 IEnumerable
public static string GetHeader(HttpRequestMessage request, string key) { IEnumerable<string> keys = null; if (!request.Headers.TryGetValues(key, out keys)) return null; return keys.First(); }
1、枚举类型 IEnumerable
public static string GetHeader(HttpRequestMessage request, string key) { IEnumerable<string> keys = null; if (!request.Headers.TryGetValues(key, out keys)) return null; return keys.First(); }