/// <summary>
        /// Refreshes the internally-cached collection of URL templates and redirection mappings.
        /// </summary>
        protected void RefreshUrlMappingData()
        {
            if (_coll != null)
            {
                _coll.Clear();
            }
            else
            {
                _coll = new UrlMappingItemCollection();
            }


            // make a connection to the database and execute the SQL stored procedure
            // to retrieve the listing of URL items in the form
            // [Name], [UrlTemplate], [Redirection]

            using (SqlConnection con = new SqlConnection(GetConnectionString()))
            {
                using (SqlCommand cmd = con.CreateCommand())
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = _procName;
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataSet        ds = new DataSet();
                    da.Fill(ds);
                    da.Dispose();

                    if (ds.Tables.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow        r = ds.Tables[0].Rows[i];
                            UrlMappingItem item
                                = UrlMappingHelper.CreateTemplatedMappingItem(
                                      r["Name"].ToString(), r["UrlTemplate"].ToString(), r["Redirection"].ToString(), _qsBehavior
                                      );

                            _coll.Add(item);
                        }
                    }
                }
            }

            // if we're using a sqlDependency, generate it now
            if (_useDependency)
            {
                _sqlDependency = new SqlCacheDependency(_dependencyName, _tableName);
                HttpContext.Current.Cache.Insert(kCACHE_KEY, "dummyValue", _sqlDependency, DateTime.Now.AddDays(10), Cache.NoSlidingExpiration);
            }

            // remember the refresh time
            _latestRefresh = System.DateTime.Now;
        }
        /// <summary>
        /// Refreshes the internally-cached collection of URL templates and redirection mappings.
        /// </summary>
        protected void RefreshUrlMappingData()
        {
            if (_coll != null)
            {
                _coll.Clear();
            }
            else
            {
                _coll = new UrlMappingItemCollection();
            }


            // parse the given xml file to retrieve the listing of URL items;
            // the xml file should include tags in the form:
            // <urlMapping name="" urlTemplate="" redirection="" />

            XmlDocument xml  = new XmlDocument();
            string      file = HttpContext.Current.Server.MapPath(_urlMappingFile);

            try
            {
                xml.Load(file);
            }
            catch (Exception ex)
            {
                throw new ProviderException("There is an XmlUrlMappingModule error.  The error occurred while loading the urlMappingFile.  A virtual path is required and the file must be well-formed.", ex);
            }

            // parse the file for <urlMapping> tags
            XmlNodeList nodes = xml.SelectNodes("//urlMapping");

            foreach (XmlNode node in nodes)
            {
                // retrieve name, urlTemplate, and redirection attributes;
                // ensure urlTemplate and redirection are present
                string name        = XmlAttributeValue(node, "name");
                string urlTemplate = XmlAttributeValue(node, "urlTemplate");
                string redirection = XmlAttributeValue(node, "redirection");
                bool   enabled     = XmlAttributeBoolean(node, "enabled", true);

                if (enabled)
                {
                    if (string.IsNullOrEmpty(urlTemplate))
                    {
                        throw new ProviderException("There is an XmlUrlMappingModule error.  All <urlMapping> tags in the mapping file require a 'urlTemplate' attribute.");
                    }

                    if (string.IsNullOrEmpty(urlTemplate))
                    {
                        throw new ProviderException("There is an XmlUrlMappingModule error.  All <urlMapping> tags in the mapping file require a 'redirection' attribute.");
                    }

                    // still here, we can create the item and add to the collection
                    UrlMappingItem item
                        = UrlMappingHelper.CreateTemplatedMappingItem(
                              name, urlTemplate, redirection, _qsBehavior
                              );

                    _coll.Add(item);
                }
            }



            // if we're using a file dependency, generate it now
            if (_useDependency)
            {
                _fileDependency = new CacheDependency(file);
                HttpContext.Current.Cache.Insert(kCACHE_KEY, "dummyValue", _fileDependency);
            }

            // remember the refresh time
            _latestRefresh = System.DateTime.Now;
        }