internal void SaveSettings()
        {
            // Load the web.config file
            var filename  = HttpContext.Current.Server.MapPath("~/web.config");
            var webconfig = new ConfigXmlDocument();

            webconfig.Load(filename);

            var node = webconfig.SelectSingleNode("/configuration/connectionStrings/add[@name='RedisCachingProvider']");

            SaveAttribute(node, "connectionString", ConnectionString);

            node = webconfig.SelectSingleNode("/configuration/dotnetnuke/caching");
            SaveAttribute(node, "defaultProvider", CachingProviderEnabled ? "RedisCachingProvider" : "FileBasedCachingProvider");

            node = webconfig.SelectSingleNode("/configuration/dotnetnuke/outputCaching");
            SaveAttribute(node, "defaultProvider", OutputCachingProviderEnabled ? "RedisOutputCachingProvider" : "MemoryOutputCachingProvider");

            node = webconfig.SelectSingleNode("/configuration/dotnetnuke/caching/providers/add[@name='RedisCachingProvider']");
            SaveAttribute(node, "useCompression", UseCompression.ToString());
            SaveAttribute(node, "silentMode", SilentMode.ToString());
            SaveAttribute(node, "keyPrefix", KeyPrefix);

            node = webconfig.SelectSingleNode("/configuration/dotnetnuke/outputCaching/providers/add[@name='RedisOutputCachingProvider']");
            SaveAttribute(node, "useCompression", UseCompression.ToString());
            SaveAttribute(node, "silentMode", SilentMode.ToString());
            SaveAttribute(node, "keyPrefix", KeyPrefix);

            webconfig.Save(filename);

            // Clear the cache
            DotNetNuke.Services.Cache.CachingProvider.Instance().PurgeCache();
        }
        public override string ToString()
        {
            var parameters = HttpUtility.ParseQueryString(string.Empty); // NameValueCollection but a special one

            parameters.Set("enable_http_compression", UseCompression.ToString(CultureInfo.InvariantCulture).ToLowerInvariant());
            parameters.Set("default_format", DefaultFormat);
            parameters.SetOrRemove("database", Database);
            parameters.SetOrRemove("session_id", SessionId);
            parameters.SetOrRemove("query", Sql);

            foreach (var parameter in queryParameters)
            {
                parameters.Set("param_" + parameter.Key, parameter.Value);
            }

            if (CustomParameters != null)
            {
                foreach (var parameter in CustomParameters)
                {
                    parameters.Set(parameter.Key, Convert.ToString(parameter.Value, CultureInfo.InvariantCulture));
                }
            }
            var uriBuilder = new UriBuilder(BaseUri)
            {
                Query = parameters.ToString()
            };

            return(uriBuilder.ToString());
        }