İngilizce dilinde oku

Aracılığıyla paylaş


Cookie.CommentUri Özellik

Tanım

Sunucunun ile Cookiesağlayabilecekleri bir URI açıklamasını alır veya ayarlar.

C#
public Uri CommentUri { get; set; }
C#
public Uri? CommentUri { get; set; }

Özellik Değeri

Uri

Bu Cookieiçin URI başvurusunun hedeflenen kullanımını temsil eden isteğe bağlı bir açıklama. Değerin URI biçimine uygun olması gerekir.

Örnekler

Aşağıdaki örnek, yanıt olarak döndürülen tanımlama bilgilerinin özelliklerini görüntüler. Tam örnek için sınıf konusuna Cookie bakın.

C#
var request = (HttpWebRequest)WebRequest.Create(args[0]);
request.CookieContainer = new CookieContainer();

using (var response = (HttpWebResponse) request.GetResponse())
{
    // Print the properties of each cookie.
    foreach (Cookie cook in response.Cookies)
    {
        Console.WriteLine("Cookie:");
        Console.WriteLine($"{cook.Name} = {cook.Value}");
        Console.WriteLine($"Domain: {cook.Domain}");
        Console.WriteLine($"Path: {cook.Path}");
        Console.WriteLine($"Port: {cook.Port}");
        Console.WriteLine($"Secure: {cook.Secure}");

        Console.WriteLine($"When issued: {cook.TimeStamp}");
        Console.WriteLine($"Expires: {cook.Expires} (expired? {cook.Expired})");
        Console.WriteLine($"Don't save: {cook.Discard}");
        Console.WriteLine($"Comment: {cook.Comment}");
        Console.WriteLine($"Uri for comments: {cook.CommentUri}");
        Console.WriteLine($"Version: RFC {(cook.Version == 1 ? 2109 : 2965)}");

        // Show the string representation of the cookie.
        Console.WriteLine($"String: {cook}");
    }
}

Açıklamalar

URI, sunucunun öğesini nasıl kullandığı Cookiegibi isteğe bağlı bilgiler sağlayabilir.

Şunlara uygulanır

Ürün Sürümler
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

Ayrıca bkz.