Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 1.1
.NET Framework
Reference
System.Web
Methods
 SetLastModified Method

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
.NET Framework Class Library
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

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker