System.Web Namespace HttpCookie Class
Sets or retrieves the expiration date and time for the cookie.
[ VB ]
Public Property Expires As DateTime
[ C# ]
public DateTime Expires {get; set;}
[ C++ ]
public: __property DateTime get_Expires ( );
public: __property void set_Expires ( DateTime );
[ JScript ]
public function get Expires ( ) : DateTime;
public function set Expires ( DateTime );
The time of day ( on the client ) at which the cookie expires.
The following example sets the expiration time of the cookie to 10 minutes from the current time.
[ VB ]
Dim dt As DateTime = DateTime.Now ( )
Dim ts As New TimeSpan ( 0,0,10,0 )
myCookie.Expires = dt.Add ( ts )
[ C# ]
DateTime dt = DateTime.Now;
TimeSpan ts = new TimeSpan ( 0,0,10,0 );
myCookie.Expires = dt.Add ( ts );
[ JScript ]
var dt : DateTime = DateTime.Now
var ts : TimeSpan = new TimeSpan ( 0,0,10,0 )
myCookie.Expires = dt.Add ( ts )
HttpCookie Members