예제 #1
0
        protected void Application_BeginRequest(object sender, EventArgs e)
        {
            var path = HttpContext.Current.Request.Path;

            // We intercept requests for sitemaps and handle them here
            var match = SitemapPathRegex.Match(path);

            if (match.Success)
            {
                var domainDataCode = match.Groups["dataCode"].Captures[0].Value;
                if (domainDataCode.ToUpper() != "US")
                {
                    return;
                }
                SitemapManager.ServeSitemap(domainDataCode);
                CompleteRequest();
                return;
            }

            // ... and uploaded images
            match = UploadedImagesRegex.Match(path);
            if (match.Success)
            {
                var externalName = match.Groups["name"].Captures[0].Value;
                ImageUtility.ServeImage(externalName);
                CompleteRequest();
                return;
            }
        }
예제 #2
0
        public static int UpdateSitemapVirtualPage()
        {
            string message;
            var    pages = 0;

            try
            {
                VotePage.LogInfo("UpdateSitemapVirtualPage", "Started");

                //var table = Sitemap.GetAllKeyData(0);
                //foreach (var row in table)
                //  new SitemapManager().UpdateVirtualPage(row.DomainDataCode);

                pages = new SitemapManager().UpdateVirtualPage();

                message = "Completed";
            }
            catch (Exception ex)
            {
                VotePage.LogException("UpdateSitemapVirtualPage", ex);
                message = $"Exception: {ex.Message} [see exception log for details]";
            }

            VotePage.LogInfo("UpdateSitemapVirtualPage", message);
            return(pages);
        }