Rediger

Del via


HttpCachePolicy.SetLastModified(DateTime) Method

Definition

Sets the Last-Modified HTTP header to the DateTime value supplied.

public:
 void SetLastModified(DateTime date);
public void SetLastModified (DateTime date);
member this.SetLastModified : DateTime -> unit
Public Sub SetLastModified (date As DateTime)

Parameters

date
DateTime

The new DateTime value for the Last-Modified header.

Exceptions

date is later than the current DateTime.

Examples

The following code example demonstrates how to set the Last-Modified header to a new date.

Response.Cache.SetLastModified(DateTime.Parse("1/1/2001 00:00:01AM"));
Response.Cache.SetLastModified(DateTime.Parse("1/1/2001 00:00:01AM"))

Remarks

The Last-Modified HTTP header time stamps the document with the DateTime value indicating when the document was last modified.

This method will fail if the caching restrictiveness hierarchy is violated.

SetLastModified is introduced in the .NET Framework version 3.5. For more information, see Versions and Dependencies.

Applies to