在 .NET 中以编程方式获取 outputcacheprofile 的持续时间

Grab duration of outputcacheprofile programmatically in .NET

ASP.NET 中有没有办法以编程方式获取输出缓存配置文件的 duration

<outputCacheProfiles>
          <add name="Documents" duration="600" enabled="false" varyByParam="*" />
private int GetSetting()
{
    // Get the Web application configuration.
    System.Configuration.Configuration webConfig =
        WebConfigurationManager.OpenWebConfiguration("~/");

    // Get the section.
    string configPath = "system.web/caching/outputCacheSettings";
    System.Web.Configuration.OutputCacheSettingsSection outputCacheSettings =
        (System.Web.Configuration.OutputCacheSettingsSection)webConfig.GetSection(
            configPath);

    // Get the profile at zero index.
    System.Web.Configuration.OutputCacheProfile outputCacheProfile =
        outputCacheSettings.OutputCacheProfiles[0];

    return outputCacheProfile.Duration;
}