HttpCachePolicy.SetLastModified(DateTime) 方法

定义

Last-Modified HTTP 标头设置为 DateTime 提供的值。

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

参数

date
DateTime

标头的新 DateTimeLast-Modified

例外

date 晚于当前 DateTime

示例

下面的代码示例演示如何将 Last-Modified 标头设置为新日期。

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

注解

Last-Modified HTTP 标头时间戳,其中包含DateTime指示上次修改文档的时间的值。

如果违反缓存限制性层次结构,此方法将失败。

.NET Framework 版本 3.5 中引入了 SetLastModified。 有关详细信息,请参阅 版本和依赖项

适用于