Bahasa

HttpCookieCollection.Item[] Properti

Definisi

Mendapatkan cookie dengan nama yang ditentukan dari koleksi cookie. Properti ini kelebihan beban untuk memungkinkan pengambilan cookie dengan nama atau indeks numerik.

Overload

Nama Deskripsi
Item[Int32]

Mendapatkan cookie dengan indeks numerik yang ditentukan dari koleksi cookie.

Item[String]

Mendapatkan cookie dengan nama yang ditentukan dari koleksi cookie.

Item[Int32]

Mendapatkan cookie dengan indeks numerik yang ditentukan dari koleksi cookie.

public:
 property System::Web::HttpCookie ^ default[int] { System::Web::HttpCookie ^ get(int index); };
public System.Web.HttpCookie this[int index] { get; }
member this.Item(int) : System.Web.HttpCookie
Default Public ReadOnly Property Item(index As Integer) As HttpCookie

Parameter

index
Int32

Indeks cookie yang akan diambil dari koleksi.

Nilai Properti

Ditentukan HttpCookie oleh index.

Contoh

Contoh berikut menyimpan nama cookie pertama sebagai variabel string (indeks = 0) dalam koleksi cookie.

String CookieName = MyCookieCollection[0].Name;
Dim CookieName As String = MyCookieCollection(0).Name

Lihat juga

Berlaku untuk

Item[String]

Mendapatkan cookie dengan nama yang ditentukan dari koleksi cookie.

public:
 property System::Web::HttpCookie ^ default[System::String ^] { System::Web::HttpCookie ^ get(System::String ^ name); };
public System.Web.HttpCookie this[string name] { get; }
member this.Item(string) : System.Web.HttpCookie
Default Public ReadOnly Property Item(name As String) As HttpCookie

Parameter

name
String

Nama cookie yang akan diambil.

Nilai Properti

Ditentukan HttpCookie oleh name.

Contoh

Contoh berikut mendapatkan cookie dengan nama "LastVisit" dan mengekstrak nilainya.

String str;
 str = Request.Cookies["LastVisit"].Value;
Dim str As String
 str = Request.Cookies("LastVisit").Value

Lihat juga

Berlaku untuk