Partager via


HttpRequestHeadersExtensions.GetCookies Method ()

Gets any cookie headers present in the request.

Namespace:  System.Net.Http
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function GetCookies ( _
    headers As HttpRequestHeaders _
) As Collection(Of CookieHeaderValue)
'Usage
Dim headers As HttpRequestHeaders 
Dim returnValue As Collection(Of CookieHeaderValue)

returnValue = headers.GetCookies()
public static Collection<CookieHeaderValue> GetCookies(
    this HttpRequestHeaders headers
)
[ExtensionAttribute]
public:
static Collection<CookieHeaderValue^>^ GetCookies(
    HttpRequestHeaders^ headers
)
static member GetCookies : 
        headers:HttpRequestHeaders -> Collection<CookieHeaderValue> 
public static function GetCookies(
    headers : HttpRequestHeaders
) : Collection<CookieHeaderValue>

Parameters

  • headers
    Type: HttpRequestHeaders

    The request headers.

Return Value

Type: System.Collections.ObjectModel.Collection<CookieHeaderValue>
A collection of CookieHeaderValue instances.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type HttpRequestHeaders. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

See Also

Reference

HttpRequestHeadersExtensions Class

GetCookies Overload

System.Net.Http Namespace