Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>They are 2 different things, one <strong>SAVES</strong> [Response], the other <strong>READS</strong> [Request] </p> <p>in a Cookie (informatics speaking) :) you save a small file for a <strong>period of time</strong> that contains an object of the type <strong>string</strong></p> <p>in the .NET framework you <a href="http://msdn.microsoft.com/en-us/library/aa287547(VS.71).aspx" rel="noreferrer">save a cookie</a> doing:</p> <pre><code>HttpCookie myCookie = new HttpCookie("MyTestCookie"); DateTime now = DateTime.Now; // Set the cookie value. myCookie.Value = now.ToString(); // Set the cookie expiration date. myCookie.Expires = now.AddMinutes(1); // Add the cookie. Response.Cookies.Add(myCookie); Response.Write("&lt;p&gt; The cookie has been written."); </code></pre> <p>You wrote a cookie that will be available for one minute... normally we do <em>now.AddMonth(1)</em> so you can save a cookie for one entire month.</p> <p>To <a href="http://msdn.microsoft.com/en-us/library/aa287533(VS.71).aspx" rel="noreferrer">retrieve a cookie</a>, you use the Request (you are Requesting), like:</p> <pre><code>HttpCookie myCookie = new HttpCookie("MyTestCookie"); myCookie = Request.Cookies["MyTestCookie"]; // Read the cookie information and display it. if (myCookie != null) Response.Write("&lt;p&gt;"+ myCookie.Name + "&lt;p&gt;"+ myCookie.Value); else Response.Write("not found"); </code></pre> <p><strong>Remember:</strong></p> <p>To Delete a Cookie, there is no direct code, the trick is to <strong>Save</strong> the same Cookie Name with an Expiration date that already passed, for example, <strong>now.AddMinutes(-1)</strong></p> <p>this will delete the cookie.</p> <p>As you can see, every time that the time of life of the cookie expires, that file is deleted from the system automatically.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload