HttpCookie.Name Özellik

Tanım

Tanımlama bilgisinin adını alır veya ayarlar.

public:
 property System::String ^ Name { System::String ^ get(); void set(System::String ^ value); };
public string Name { get; set; }
member this.Name : string with get, set
Public Property Name As String

Özellik Değeri

Oluşturucu aksini belirtmediği sürece varsayılan değer null başvurudur (Nothing Visual Basic'te).

Örnekler

Aşağıdaki kod örneği, üst bilgide Cookie istemciden bir tanımlama bilgisi koleksiyonu alır ve belirli bir ada sahip bir tanımlama bilgisi aramak için koleksiyonda döngü yapar.

int loop1;
 HttpCookie MyCookie;
 HttpCookieCollection MyCookieCollection;

 MyCookieCollection = Request.Cookies;

 for (loop1 = 0; loop1 < MyCookieCollection.Count; loop1++)
 {
    MyCookie = MyCookieCollection[loop1];
    if (MyCookie.Name == "UserName")
    {
       //...
    }
 }

Dim loop1 As Integer
 Dim MyCookie As HttpCookie
 Dim MyCookieCollection As HttpCookieCollection 
 
 MyCookieCollection = Request.Cookies
 
 For loop1 = 0 TO MyCookieCollection.Count - 1
    MyCookie = MyCookieCollection(loop1)
    If MyCookie.Name = "UserName" Then
       '...
    End If
 Next loop1
    

Şunlara uygulanır

Ayrıca bkz.