ASP.NET cookie expiration date not saved

by APIJunkie 3/1/2009 10:40:00 PM

When reading/reusing a cookie sent from the client do not expect the expiration date to be valid.

The following excerpt is taken from MSDN regarding cookies:

"To be clear, you can read the Expires property of a cookie that you have set in the Response object, before the cookie has been sent to the browser. However, you cannot get the expiration back in the Request object."

Here are 2 things to remember:

1. If you need to save the cookie expiration date, save it in another place besides the Expires property.

2. Remember to always set the expiration date before sending a cookie back to the client.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.NET | Troubleshoot | Web Development

Comments

3/1/2009 10:44:03 PM

trackback

Trackback from DotNetKicks.com

ASP.NET cookie expiration date not saved

DotNetKicks.com

Comments are closed

Powered by BlogEngine.NET 1.2.0.0
Theme by Mads Kristensen

About the author

Name of author

My name is Bacon…James Bacon.

I am an API wars veteran I was wounded by x86 assembly, recovered and moved on to C. Following a long addiction to C++ and a short stint at rehab I decided to switch to a healthier addiction so I am now happily sniffing .NET and getting hooked on Silverlight.

I am mainly here to ramble about coding, various API’s, Junkies(me especially) and everything else that happens between coders and their significant other.

E-mail me Send mail


Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in