private XmlDocument BuildSitemapItem(XmlDocument doc, Item item, Site site, Language language)
        {
            var      str       = HttpUtility.UrlPathEncode(this.GetItemUrl(item, site, language));
            DateTime updated   = item.Statistics.Updated;
            string   str1      = SitemapManager.HtmlEncode(updated.ToString("yyyy-MM-ddTHH:mm:sszzz"));
            string   priority  = GetSitemapPriority(item);
            XmlNode  lastChild = doc.LastChild;
            XmlNode  xmlNodes  = doc.CreateElement("url");

            lastChild.AppendChild(xmlNodes);
            XmlNode xmlNodes1 = doc.CreateElement("loc");

            xmlNodes.AppendChild(xmlNodes1);
            xmlNodes1.AppendChild(doc.CreateTextNode(str));
            XmlNode xmlNodes2 = doc.CreateElement("lastmod");

            xmlNodes.AppendChild(xmlNodes2);
            xmlNodes2.AppendChild(doc.CreateTextNode(str1));
            XmlNode xmlNodesChangeFreq = doc.CreateElement("changefreq");

            xmlNodes.AppendChild(xmlNodesChangeFreq);
            xmlNodesChangeFreq.AppendChild(doc.CreateTextNode("daily"));
            XmlNode xmlNodesPriority = doc.CreateElement("priority");

            xmlNodes.AppendChild(xmlNodesPriority);
            xmlNodesPriority.AppendChild(doc.CreateTextNode(priority));
            return(doc);
        }
 private void SubmitEngine(string engine, string sitemapUrl)
 {
     if (!sitemapUrl.Contains("http://localhost"))
     {
         string         str            = string.Concat(engine, SitemapManager.HtmlEncode(sitemapUrl));
         HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(str);
         try
         {
             if (((HttpWebResponse)httpWebRequest.GetResponse()).StatusCode != HttpStatusCode.OK)
             {
                 Log.Error(string.Format("Cannot submit sitemap to \"{0}\"", engine), this);
             }
         }
         catch
         {
             Log.Warn(string.Format("The serachengine \"{0}\" returns an 404 error", str), this);
         }
     }
 }
Exemple #3
0
        public void RefreshSitemap(object sender, EventArgs args)
        {
            SitemapManager sitemapManager = new SitemapManager();

            sitemapManager.SubmitSitemapToSearchenginesByHttp();
        }