Question AddDays Out of Range

Richard Creer

New member
Joined
Dec 8, 2008
Messages
4
Programming Experience
10+
Any idea how

Response.Cookies(cookieName).Expires = DateTime.Now.AddDays(500)

can throw

System.ArgumentOutOfRangeException: Value to add was out of range.
Parameter name: value
at System.DateTime.Add(Double value, Int32 scale)
at System.DateTime.AddDays(Double value)

Seems to me this must always work until we are approaching the year 10,000 yet it fails for me regularly but unreproducibly.

TIA
 
Back
Top