Exemplo n.º 1
0
 /// <summary>
 ///   Sets the cache policy.  Unless a handler overrides
 ///   this method, handlers will not allow a respons to be
 ///   cached.
 /// </summary>
 /// <param name = "cache">Cache.</param>
 public virtual void SetResponseCachePolicy(HttpCachePolicy cache)
 {
     cache.SetCacheability(HttpCacheability.NoCache);
     cache.SetNoStore();
     cache.SetExpires(DateTime.MinValue);
 }
 public override void SetNoStore()
 {
     _httpCachePolicy.SetNoStore();
 }
Exemplo n.º 3
0
		/// <summary>
		/// Configures ASP.Net's Cache policy based on properties set
		/// </summary>
		/// <param name="policy">cache policy to set</param>
		void ICachePolicyConfigurer.Configure(HttpCachePolicy policy)
		{
			policy.SetAllowResponseInBrowserHistory(allowInHistory);
			policy.SetCacheability(cacheability);
			policy.SetOmitVaryStar(omitVaryStar);
			policy.SetRevalidation(revalidation);
			policy.SetSlidingExpiration(slidingExpiration);
			policy.SetValidUntilExpires(validUntilExpires);

			if (duration != 0)
			{
				policy.SetExpires(DateTime.Now.AddSeconds(duration));
			}

			if (varyByContentEncodings != null)
			{
				foreach (var header in varyByContentEncodings.Split(','))
				{
					policy.VaryByContentEncodings[header.Trim()] = true;
				}
			}

			if (varyByCustom != null)
			{
				policy.SetVaryByCustom(varyByCustom);
			}

			if (varyByHeaders != null)
			{
				foreach (var header in varyByHeaders.Split(','))
				{
					policy.VaryByHeaders[header.Trim()] = true;
				}
			}

			if (varyByParams != null)
			{
				foreach (var param in varyByParams.Split(','))
				{
					policy.VaryByParams[param.Trim()] = true;
				}
			}

			if (cacheExtension != null)
			{
				policy.AppendCacheExtension(cacheExtension);
			}

			if (setEtagFromFileDependencies)
			{
				policy.SetETagFromFileDependencies();
			}

			if (setLastModifiedFromFileDependencies)
			{
				policy.SetLastModifiedFromFileDependencies();
			}

			if (setNoServerCaching)
			{
				policy.SetNoServerCaching();
			}

			if (setNoStore)
			{
				policy.SetNoStore();
			}

			if (setNoTransforms)
			{
				policy.SetNoTransforms();
			}

			if (etag != null)
			{
				policy.SetETag(etag);
			}

			if (isLastModifiedSet)
			{
				policy.SetLastModified(lastModified);
			}

			if (isMaxAgeSet)
			{
				policy.SetMaxAge(TimeSpan.FromSeconds(maxAge));
			}

			if (isProxyMaxAgeSet)
			{
				policy.SetProxyMaxAge(TimeSpan.FromSeconds(proxyMaxAge));
			}
		}
Exemplo n.º 4
0
 public override void SetNoStore()
 {
     w.SetNoStore();
 }