asp.net.ph

HttpCookie.Expires Property

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 );

Property Value

The time of day ( on the client ) at which the cookie expires.

Example

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 )
See Also

HttpCookie Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph