Domanda

Sto cercando un buon esempio di memorizzazione dei dati in un cookie utilizzando ASP.NET. Qualcuno potrebbe mostrarmi un esempio?

È stato utile?

Altri suggerimenti

MSDN è piuttosto tuo amico: http://msdn.microsoft.com/ it-it / library / 78c837bd.aspx

Fino ad allora:

C#:  
Response.Cookie["cookie_name"] = "value";

VB:  
Response.Cookie("cookie_name") = "value";

Come creare un cookie

HttpCookie mycookie = new HttpCookie("mycookie");
mycookie.Value = "chocolate chip please.";
Response.Cookies.Add(mycookie);

Come leggere un cookie

HttpCookie mycookie = Request.Cookies["mycookie"];
Response.Write("Your cookie is: " + mycookie.Value);

Google afferma " < a href = "http://msdn.microsoft.com/en-us/library/78c837bd.aspx" rel = "nofollow noreferrer"> Come scrivere un cookie "

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top