This documentation is archived and is not being maintained.

HttpCachePolicy.SetLastModified Method

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

[Visual Basic]
Public Sub SetLastModified( _
   ByVal date As DateTime _
)
[C#]
public void SetLastModified(
 DateTime date
);
[C++]
public: void SetLastModified(
 DateTime date
);
[JScript]
public function SetLastModified(
   date : DateTime
);

Parameters

date
The new DateTime value for the Last-Modified header.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException date is earlier than the current DateTime.

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.

Example

[Visual Basic, JScript] The following example sets the Last-Modified header to a new date.

[Visual Basic] 
Response.Cache.SetLastModified(DateTime.Parse("1/1/2001 00:00:01AM"))
 

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

[C#, C++] No example is available for C# or C++. To view a Visual Basic or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpCachePolicy Class | HttpCachePolicy Members | System.Web Namespace

Show: