protected void Page_Load(object sender, EventArgs e) { DebugHelper.SetContext("GetMetaFile"); // Load the site name LoadSiteName(); int cacheMinutes = CacheMinutes; // Try to get data from cache using (var cs = new CachedSection <CMSOutputMetaFile>(ref outputFile, cacheMinutes, true, null, "getmetafile", CurrentSiteName, GetBaseCacheKey(), Request.QueryString)) { if (cs.LoadData) { // Process the file ProcessFile(); if (cs.Cached) { // Do not cache if too big file which would be stored in memory if ((outputFile != null) && (outputFile.MetaFile != null) && !CacheHelper.CacheImageAllowed(CurrentSiteName, outputFile.MetaFile.MetaFileSize) && !AttachmentInfoProvider.StoreFilesInFileSystem(CurrentSiteName)) { cacheMinutes = largeFilesCacheMinutes; } if (cacheMinutes > 0) { // Prepare the cache dependency CMSCacheDependency cd = null; if (outputFile != null) { if (outputFile.MetaFile != null) { // Add dependency on this particular meta file cd = GetCacheDependency(outputFile.MetaFile.GetDependencyCacheKeys()); } } if (cd == null) { // Set default dependency based on GUID cd = CacheHelper.GetCacheDependency(new string[] { "metafile|" + fileGuid.ToString().ToLowerCSafe() }); } cs.CacheDependency = cd; } // Cache the data cs.CacheMinutes = cacheMinutes; } cs.Data = outputFile; } } // Send the data SendFile(outputFile); DebugHelper.ReleaseContext(); }