HttpCookieCollection.Item[] Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the cookie with the specified name from the cookie collection. This property is overloaded to allow retrieval of cookies by either name or numerical index.
Overloads
Item[Int32] |
Gets the cookie with the specified numerical index from the cookie collection. |
Item[String] |
Gets the cookie with the specified name from the cookie collection. |
Item[Int32]
Gets the cookie with the specified numerical index from the cookie collection.
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
Parameters
- index
- Int32
The index of the cookie to retrieve from the collection.
Property Value
The HttpCookie specified by index
.
Examples
The following example stores the name of the first cookie as a string variable (index = 0) in a cookie collection.
String CookieName = MyCookieCollection[0].Name;
Dim CookieName As String = MyCookieCollection(0).Name
See also
Applies to
Item[String]
Gets the cookie with the specified name from the cookie collection.
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
Parameters
- name
- String
Name of cookie to retrieve.
Property Value
The HttpCookie specified by name
.
Examples
The following example gets the cookie with the name "LastVisit" and extracts its value.
String str;
str = Request.Cookies["LastVisit"].Value;
Dim str As String
str = Request.Cookies("LastVisit").Value
See also
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기