Share via


HttpCookie.Expires Property

Definition

Get or set the expiration date and time for the HttpCookie.

public:
 property IReference<DateTime> ^ Expires { IReference<DateTime> ^ get(); void set(IReference<DateTime> ^ value); };
IReference<DateTime> Expires();

void Expires(IReference<DateTime> value);
public System.Nullable<System.DateTimeOffset> Expires { get; set; }
var iReference = httpCookie.expires;
httpCookie.expires = iReference;
Public Property Expires As Nullable(Of DateTimeOffset)

Property Value

The expiration date and time for the HttpCookie.

Remarks

Setting the Expires property to null makes this a Cookie that is only good for the current HTTP session and will not be persisted. Setting the Expires property to a date in the past deletes the Cookie.

The default value for the Expires property is null.

Javascript and .NET languages do not use DateTime directly. In Javascript a DateTime is projected as a Date object, and in .NET it is projected as a System.DateTimeOffset structure. In C++, the DateTime.UniversalTime member has the same granularity as a and supports the date ranges required by Javascript and .NET.

Applies to

See also