本文整理汇总了C#中HttpHeaders.GetValues方法的典型用法代码示例。如果您正苦于以下问题:C# HttpHeaders.GetValues方法的具体用法?C# HttpHeaders.GetValues怎么用?C# HttpHeaders.GetValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpHeaders
的用法示例。
在下文中一共展示了HttpHeaders.GetValues方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClaimsForRoleAsync
private static async Task<ClaimsPrincipal> GetClaimsForRoleAsync(HttpHeaders role)
{
return await Task.Run(() => new ClaimsPrincipal(new List<ClaimsIdentity>
{
new ClaimsIdentity("SecureAuth", "SafeType", role.GetValues("RoleType").FirstOrDefault())
}));
}
示例2: GetHttpRequestHeader
private static string GetHttpRequestHeader(HttpHeaders headers, string headerName)
{
if (!headers.Contains(headerName))
return string.Empty;
return headers.GetValues(headerName)
.SingleOrDefault();
}
示例3: HaveOneMatchingItemWithin
private static Func<KeyValuePair<string, string>, bool> HaveOneMatchingItemWithin(HttpHeaders headers)
{
return item =>
{
if (!headers.Contains(item.Key))
{
return false;
}
var expectedValues = Regex.Split(item.Value, @",\s*");
var actualValues = headers.GetValues(item.Key);
return headers.Contains(item.Key)
&& expectedValues.OrderBy(i => i).SequenceEqual(actualValues.OrderBy(i => i));
};
}
示例4: GetAuthCookie
private string GetAuthCookie(HttpHeaders responseHeaders)
{
var cookiehHeaders = responseHeaders.GetValues("Set-Cookie");
foreach (var header in cookiehHeaders)
{
var cookieParts = header.Split(';');
var cookie = cookieParts[0];
var parts = cookie.Split('=');
if (parts[0].Equals(IdentityCookieName, StringComparison.OrdinalIgnoreCase))
{
return parts[1];
}
}
return String.Empty;
}
示例5: AddCookiesToRequest
private void AddCookiesToRequest(HttpHeaders responseHeaders, HttpHeaders requestHeaders)
{
var cookiehHeaders = responseHeaders.GetValues("Set-Cookie");
foreach (var header in cookiehHeaders)
{
var cookieParts = header.Split(';');
var cookie = cookieParts[0];
var parts = cookie.Split('=');
requestHeaders.Add("Cookie", String.Format("{0}={1}", parts[0], parts[1]));
}
}
示例6: GetFilteredMetadataFromHeaders
protected override RavenJObject GetFilteredMetadataFromHeaders(HttpHeaders headers)
{
var result = base.GetFilteredMetadataFromHeaders(headers);
if (headers.Contains(Constants.RavenLastModified))
{
// this is required to resolve conflicts based on last modification date
result.Add(Constants.RavenLastModified, headers.GetValues(Constants.RavenLastModified).First());
}
return result;
}