Item Property (String)
Collapse the table of content
Expand the table of content

CookieCollection.Item Property (String)

 

Gets the Cookie with a specific name from a CookieCollection.

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

Public ReadOnly Property Item (
	name As String
) As Cookie

Parameters

name
Type: System.String

The name of the Cookie to be found.

Property Value

Type: System.Net.Cookie

The Cookie with a specific name from a CookieCollection.

Exception Condition
ArgumentNullException

name is null.

You can use this to iterate over the contents of a CookieCollection.

' Get the cookies in the 'CookieCollection' object using the 'Item' property.


Try
    If cookies.Count = 0 Then
        Console.WriteLine("No cookies to display")
        Return
    End If
    Console.WriteLine("{0}", cookies("UserName").ToString())
    Console.WriteLine("{0}", cookies("DateOfBirth").ToString())
    Console.WriteLine("{0}", cookies("PlaceOfBirth").ToString())
    Console.WriteLine("")
Catch e As Exception
    Console.WriteLine(("Exception raised." + ControlChars.Cr + "Error : " + e.Message))
End Try

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show:
© 2016 Microsoft