TEMPESTINI.NET

Observations in Software Development

Permanent vs. Temporary Cookies

Posted by Rick Tempestini on August 18, 2007

Cookies, by default, when created using the following code sample, expire when the browser closes:

code-sample-cookie-no-expiration.jpg

If, however, the Expires property is set to a date and time in the future of the current date and time, a persistent cookie file will be written to the local client hard drive. For Internet Explorer, cookies are placed in the c:\Documents and Settings\[user_name]\Cookies directory.

Therefore, the code sample below will write a permanent cookie to the clients hard drive because the Expire property was set to a time in the future.

code-sample-cookie-with-expiration.jpg

Now, looking into my local cookies directory I see my new cookie file:

file-explorer-with-new-cookie.jpg

If I open the cookie, I can now see the name of the cookie “TestCookie” and the name-value pair that I stored in the cookie: setting1-test.

test-cookie.jpg

Advertisement

4 Responses to “Permanent vs. Temporary Cookies”

  1. Tech Question:
    Q

  2. Good day is Blogengine a free blogging software like wordpress? Also does it have lots of plugins and themes for it? I would like to start using it for my new blog if it does. Thanks…

  3. asp.net, c#,javascript…

    [...]Permanent vs. Temporary Cookies « TEMPESTINI.NET[...]…

  4. Christmas Trees…

    [...]Permanent vs. Temporary Cookies « TEMPESTINI.NET[...]…

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.