System.Web.HttpResponse.RemoveOutputCacheItem C# (CSharp) Method

RemoveOutputCacheItem() public static method

public static RemoveOutputCacheItem ( string path ) : void
path string
return void
		public static void RemoveOutputCacheItem (string path)
		{
			if (path == null)
				throw new ArgumentNullException ("path");

			if (path.Length == 0)
				return;

			if (path [0] != '/')
				throw new ArgumentException ("'" + path + "' is not an absolute virtual path.");

#if NET_4_0
			RemoveOutputCacheItem (path, OutputCache.DefaultProviderName);
#else
			HttpContext context = HttpContext.Current;
			HttpApplication app_instance = context != null ? context.ApplicationInstance : null;
			HttpModuleCollection modules = app_instance != null ? app_instance.Modules : null;
			OutputCacheModule ocm = modules != null ? modules.Get ("OutputCache") as OutputCacheModule : null;
			OutputCacheProvider internalProvider = ocm != null ? ocm.InternalProvider : null;
			if (internalProvider == null)
				return;

			internalProvider.Remove (path);
#endif
		}

Same methods

HttpResponse::RemoveOutputCacheItem ( string path, string providerName ) : void

Usage Example

Example #1
0
 public override void RemoveOutputCacheItem(string path)
 {
     HttpResponse.RemoveOutputCacheItem(path);
 }