Ejemplo n.º 1
0
        /// <summary>
        /// 输出Xml文件
        /// </summary>
        private void ResponseXml()
        {
            Channel ch = new Channel();

            if (!string.IsNullOrEmpty(ChannelUrl))
            {
                ColoumnID = myChannelHelper.GetChannelIDByFullUrl(ChannelUrl);
            }

            if (!string.IsNullOrEmpty(ColoumnID))
            {
                ch = myChannelHelper.GetChannel(ColoumnID, null);
            }

            List <Article> list    = GetArticles();
            RssChannel     channel = new RssChannel();

            channel.Title         = ch.Name;
            channel.Link          = SiteConfigs.GetConfig().RootUrl + ch.FullUrl;
            channel.Description   = ch.Description;
            channel.Ttl           = PageSize;
            channel.Language      = "zh-cn";
            channel.LastBuildDate = DateTime.Now.ToString("yyyy-MM-dd");
            channel.PubDate       = DateTime.Now.ToString("yyyy-MM-dd");
            SetRssItems(list, channel);

            Response.Write(channel.GetXml().OuterXml);
        }