共用方式為


SPContext.UseDefaultCachePolicy property

取得或設定布林值,判斷Microsoft SharePoint Foundation是否設定從SharePoint Foundation中的項目回應的 HTTP 快取標頭。

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public Property UseDefaultCachePolicy As Boolean
    Get
    Set
'用途
Dim instance As SPContext
Dim value As Boolean

value = instance.UseDefaultCachePolicy

instance.UseDefaultCachePolicy = value
public bool UseDefaultCachePolicy { get; set; }

Property value

Type: System.Boolean
若要設定的 HTTP 快取標頭 ; true否則, false。

備註

根據預設, SharePoint Foundation會停用快取項目,例如 Web 組件頁面上。此值設定在要求上早期足夠與 ASP.NET 處理 (換言之之前的HttpApplication.ReleaseRequestState事件,就會發生),,您可以避免SharePoint Foundation設定快取標頭。

在透過Windows SharePoint Services 3.0物件模型定義的自訂應用程式,設定UseDefaultCachePolicy至false以避免SharePoint Foundation設定的快取原則,並實作 Web 控制項的控制項或頁面類別,根據使用者的資料,設定的快取標頭和產生的回應資料流的原則。若要執行在Windows SharePoint Services 3.0所定義的自訂應用程式,透過Windows SharePoint Services 2.0物件模型,您可以加入以下這一行程式碼以完成相同的結果:

[Visual Basic]

System.Web.HttpContext.Current.Items("DisableSettingBrowserCacheHeaders") = "true"

[C#]

System.Web.HttpContext.Current.Items["DisableSettingBrowserCacheHeaders"] = "true";

請參閱

參照

SPContext class

SPContext members

Microsoft.SharePoint namespace