示例#1
0
        public ActionResult Entity()
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new UTF8Encoding();
            Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

            var entityName = CommonLogic.QueryStringCanBeDangerousContent("EntityName");

            AppLogic.CheckForScriptTag(entityName);
            int entityID = CommonLogic.QueryStringUSInt("EntityID");

            var enityHelper = AppLogic.LookupHelper(entityName, 0);

            Response.Write("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n");

            Response.Write("<url>");

            var entityUrl          = Url.BuildEntityLink(entityName, entityID, string.Empty);
            var storeLocation      = new Uri(AppLogic.GetStoreHTTPLocation(false));
            var fullEntityLocation = new Uri(storeLocation, entityUrl);

            Response.Write(string.Format("<loc>{0}</loc>", XmlCommon.XmlEncode(fullEntityLocation.ToString())));
            Response.Write("<changefreq>" + AppLogic.AppConfig("SiteMapFeed.EntityChangeFreq") + "</changefreq> ");
            Response.Write("<priority>" + AppLogic.AppConfig("SiteMapFeed.EntityPriority") + "</priority> ");
            Response.Write("</url>\n");

            var siteMap = new StandardSiteMap(Url, Settings, SiteMapEntityHelper, NestedSiteMapEntityHelper);

            Response.Write(siteMap.GetEntityProductURLNodes(entityName, entityID));

            Response.Write("</urlset>");
            return(new EmptyResult());
        }
示例#2
0
        public ActionResult Index()
        {
            Response.ContentType     = "text/xml";
            Response.ContentEncoding = new UTF8Encoding();
            Response.Write("<?xml version='1.0' encoding='UTF-8'?>\n");

            Response.Write("<sitemapindex xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>\n");
            Response.Write("<sitemap>");
            var topicUrl         = Url.Action(ActionNames.Topics, ControllerNames.SiteMapFeed);
            var storeLocation    = new Uri(AppLogic.GetStoreHTTPLocation(false));
            var topicMapLocation = new Uri(storeLocation, topicUrl);

            Response.Write(string.Format("<loc>{0}</loc>", topicMapLocation));
            Response.Write("</sitemap>\n");

            var siteMap = new StandardSiteMap(Url, Settings, SiteMapEntityHelper, NestedSiteMapEntityHelper);

            Response.Write(siteMap.GetEntitySiteMap("category"));
            Response.Write(siteMap.GetEntitySiteMap("section"));
            Response.Write(siteMap.GetEntitySiteMap("manufacturer"));
            Response.Write(siteMap.GetEntitySiteMap("genre"));
            Response.Write(siteMap.GetEntitySiteMap("vector"));

            Response.Write("</sitemapindex>");
            return(new EmptyResult());
        }