HttpRequestHeadersExtensions.GetCookies Method (, String)
Gets any cookie headers present in the request that contain a cookie state whose name that matches the specified value.
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, _
name As String _
) As Collection(Of CookieHeaderValue)
'Usage
Dim headers As HttpRequestHeaders
Dim name As String
Dim returnValue As Collection(Of CookieHeaderValue)
returnValue = headers.GetCookies(name)
public static Collection<CookieHeaderValue> GetCookies(
this HttpRequestHeaders headers,
string name
)
[ExtensionAttribute]
public:
static Collection<CookieHeaderValue^>^ GetCookies(
HttpRequestHeaders^ headers,
String^ name
)
static member GetCookies :
headers:HttpRequestHeaders *
name:string -> Collection<CookieHeaderValue>
public static function GetCookies(
headers : HttpRequestHeaders,
name : String
) : Collection<CookieHeaderValue>
Parameters
headers
Type: HttpRequestHeadersThe request headers.
name
Type: System.StringThe cookie state name to match.
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).