GetProvider() static private method

static private GetProvider ( string providerName ) : System.Web.Caching.OutputCacheProvider
providerName string
return System.Web.Caching.OutputCacheProvider
        OutputCacheProvider FindCacheProvider(HttpApplication app)
        {
            HttpContext ctx = HttpContext.Current;

            if (app == null)
            {
                app = ctx != null ? ctx.ApplicationInstance : null;

                if (app == null)
                {
                    throw new InvalidOperationException("Unable to find output cache provider.");
                }
            }

            string providerName = app.GetOutputCacheProviderName(ctx);

            if (String.IsNullOrEmpty(providerName))
            {
                throw new ProviderException("Invalid OutputCacheProvider name. Name must not be null or an empty string.");
            }

            OutputCacheProvider ret = OutputCache.GetProvider(providerName);

            if (ret == null)
            {
                throw new ProviderException(String.Format("OutputCacheProvider named '{0}' cannot be found.", providerName));
            }

            return(ret);
        }