Beispiel #1
0
        /// <summary>
        /// The process request.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        public void ProcessRequest([NotNull] HttpContext context)
        {
            var siteMap = new SiteMap();

            var forumList = this.GetRepository <Forum>().ListAll(
                BoardContext.Current.BoardSettings.BoardID,
                UserMembershipHelper.GuestUserId);

            forumList.ForEach(
                forum =>
            {
                siteMap.Add(
                    new UrlLocation
                {
                    Url = BuildLink.GetLinkNotEscaped(
                        ForumPages.topics,
                        true,
                        "f={0}",
                        forum.Item1.ID),
                    Priority        = 0.8D,
                    LastModified    = forum.Item1.LastPosted ?? DateTime.UtcNow,
                    ChangeFrequency = UrlLocation.ChangeFrequencies.always
                });
            });

            context.Response.Clear();
            var xs = new XmlSerializer(typeof(SiteMap));

            context.Response.ContentType = "text/xml";
            xs.Serialize(context.Response.Output, siteMap);
            context.Response.End();
        }
Beispiel #2
0
        /// <summary>
        /// The process request.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        public void ProcessRequest([NotNull] HttpContext context)
        {
            var siteMap = new SiteMap();

            var forumList = this.GetRepository <Forum>().ListAllWithAccess(
                BoardContext.Current.BoardSettings.BoardID,
                this.Get <IAspNetUsersHelper>().GuestUserId);

            forumList.ForEach(
                forum => siteMap.Add(
                    new UrlLocation
            {
                Url          = BuildLink.GetTopicLink(forum.Item1.ID, forum.Item1.Name),
                Priority     = 0.8D,
                LastModified =
                    forum.Item1.LastPosted.HasValue
                                ? forum.Item1.LastPosted.Value.ToString(
                        "yyyy-MM-ddTHH:mm:sszzz",
                        CultureInfo.InvariantCulture)
                                : DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:sszzz", CultureInfo.InvariantCulture),
                ChangeFrequency = UrlLocation.ChangeFrequencies.always
            }));

            context.Response.Clear();

            var xs = new XmlSerializer(typeof(SiteMap));

            context.Response.ContentType = "text/xml";

            xs.Serialize(context.Response.Output, siteMap);

            context.Response.End();
        }