Close() public method

public Close ( ) : void
return void
Ejemplo n.º 1
0
    protected void WriteRSSFile()
    {
        try
        {
            string fileName = links.RssFeedLink.Replace(@"~\", ""); ;
            string filePath = HttpRuntime.AppDomainAppPath + fileName;

            XmlWriter xml = new XmlTextWriter(new StreamWriter(filePath));
            RssWriter rss = new RssWriter(xml);

            List<Item> itemList = engine.LoadItemDB(ProcessingEngine.Sort.Hot);

            rss.WriteHeader("getputs.com", "http://www.getputs.com", "All Your News Belong To Us!", null);

            foreach (Item item in itemList)
            {
                rss.WriteItem(item);
            }

            rss.Close();
            xml.Close();

        }
        catch (Exception ex)
        {
            if (log.isLoggingOn && log.isAppLoggingOn)
            {
                log.Log("Error in RssPage.aspx");
                log.Log(ex);
            }
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime     now = DateTime.Now;
        Organization org = Organization.FromIdentity(Int32.Parse(Request.QueryString["OrganizationId"]));

        ExternalActivities activities = ExternalActivities.ForOrganization(org);

        activities.Sort(ExternalActivities.SortOrder.DateDescending);

        Response.ContentType = "text/xml";

        XmlWriter xml = new XmlTextWriter(Response.Output);
        RssWriter rss = new RssWriter(xml);

        rss.WriteHeader("Aktivism - " + org.Name, "http://www.piratpartiet.se", "Aktivism för Piratpartiet", null);

        foreach (ExternalActivity activism in activities)
        {
            string title = "Aktivism i " + activism.Geography.Name;
            if (title.Length > 60)
            {
                title = title.Substring(0, 57) + "...";
            }

            rss.WriteItem(title, "<img src=\"http://data.piratpartiet.se/Handlers/DisplayActivism.aspx?Id=" + activism.Identity.ToString() + "\" />", new Uri("http://data.piratpartiet.se/Handlers/DisplayActivism.aspx?Id=" + activism.Identity), activism.CreatedDateTime);
        }

        rss.Close();
        xml.Close();
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.ContentType     = "text/xml";
        RssWriter writer = new RssWriter(Response.OutputStream);

        writer.WriteStartElement(RssElements.Rss);
        writer.WriteAttributeString(RssAttributes.Version, "2.0");
        writer.WriteStartElement(RssElements.Channel);
        writer.WriteElementString(RssElements.Title, "DotNetBips.com");
        writer.WriteElementString(RssElements.Link, "http://www.dotnetbips.com");
        writer.WriteElementString(RssElements.Description, "Latest Articles from DotNetBips.com");
        writer.WriteElementString(RssElements.Copyright, "Copyright (C) DotNetBips.com. All rights reserved.");
        writer.WriteElementString(RssElements.Generator, "Pro XML RSS Generator");
        writer.WriteStartElement(RssElements.Item);
        writer.WriteElementString(RssElements.Title, "DotNetBips.com");
        writer.WriteElementString(RssElements.Link, "http://www.dotnetbips.com/Articles/displayarticle.aspx?id=242");
        writer.WriteElementString(RssElements.Description, "This article explains how to create and consume RSS feeds.");
        writer.WriteElementString(RssElements.PubDate, "Sun, 25 Jan 2004 12:00:00 AM GMT");
        writer.WriteEndElement();
        writer.WriteEndElement();
        writer.WriteEndElement();
        writer.Close();
        Response.End();
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime now = DateTime.Now;

        MediaEntries entries = (MediaEntries) Cache.Get(cacheKey);

        if (entries == null)
        {
            entries = MediaEntries.FromBlogKeyword("Piratpartiet", now.AddDays(-7));
            Cache.Insert(cacheKey, entries, null, DateTime.UtcNow.AddMinutes (5) , System.Web.Caching.Cache.NoSlidingExpiration); // five minute cache is plenty to prevent db F5 attacks
        }
      
        Response.ContentType = "text/xml";

        XmlWriter xml = new XmlTextWriter(Response.Output);
        RssWriter rss = new RssWriter(xml);

        rss.WriteHeader("Bloggat om Piratpartiet", "http://www.piratpartiet.se", "Bloggposter som nämner Piratpartiet", null);

        foreach (MediaEntry entry in entries)
        {
            string title = entry.Title;
            if (title.Length > 30)
            {
                title = title.Substring(0, 27) + "...";
            }

            rss.WriteItem(title, string.Empty, new Uri (entry.Url), entry.DateTime);
        }

        rss.Close();
        xml.Close();
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime now = DateTime.Now;
        Organization org = Organization.FromIdentity(Int32.Parse(Request.QueryString["OrganizationId"]));

        ExternalActivities activities = ExternalActivities.ForOrganization(org);
        activities.Sort(ExternalActivities.SortOrder.DateDescending);

        Response.ContentType = "text/xml";

        XmlWriter xml = new XmlTextWriter(Response.Output);
        RssWriter rss = new RssWriter(xml);

        rss.WriteHeader("Aktivism - " + org.Name, "http://www.piratpartiet.se", "Aktivism för Piratpartiet", null);

        foreach (ExternalActivity activism in activities)
        {
            string title = "Aktivism i " + activism.Geography.Name;
            if (title.Length > 60)
            {
                title = title.Substring(0, 57) + "...";
            }

            rss.WriteItem(title, "<img src=\"http://data.piratpartiet.se/Handlers/DisplayActivism.aspx?Id=" + activism.Identity.ToString() + "\" />", new Uri("http://data.piratpartiet.se/Handlers/DisplayActivism.aspx?Id=" + activism.Identity), activism.CreatedDateTime);
        }

        rss.Close();
        xml.Close();
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.ContentEncoding = System.Text.Encoding.UTF8;
        Response.ContentType     = "text/xml";
        RssWriter writer = new RssWriter(Response.OutputStream);

        writer.WriteStartElement(RssElements.Rss);
        writer.WriteAttributeString(RssAttributes.Version, "2.0");
        writer.WriteStartElement(RssElements.Channel);
        writer.WriteElementString(RssElements.Title, "My Web Site");
        writer.WriteElementString(RssElements.Link, "http://localhost/mywebsite");
        writer.WriteElementString(RssElements.Description, "Latest Articles from My Web Site");
        writer.WriteElementString(RssElements.Copyright, "Copyright (C) My Web Site. All rights reserved.");
        writer.WriteElementString(RssElements.Generator, "My XML RSS Generator");
        writer.WriteStartElement(RssElements.Item);
        writer.WriteElementString(RssElements.Title, "Create and consume RSS Feeds");
        writer.WriteElementString(RssElements.Link, "http://localhost/mywebsite/Articles/displayarticle.aspx?id=242");
        writer.WriteElementString(RssElements.Description, "This article explains how to create and consume RSS feeds.");
        writer.WriteElementString(RssElements.PubDate, "Mon, 04 Sep 2017 12:00:00 AM GMT");
        writer.WriteEndElement();
        writer.WriteEndElement();
        writer.WriteEndElement();
        writer.Close();
        Response.End();
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime now = DateTime.Now;

        MediaEntries entries = (MediaEntries)Cache.Get(cacheKey);

        if (entries == null)
        {
            entries = MediaEntries.FromBlogKeyword("Piratpartiet", now.AddDays(-7));
            Cache.Insert(cacheKey, entries, null, DateTime.UtcNow.AddMinutes(5), System.Web.Caching.Cache.NoSlidingExpiration);   // five minute cache is plenty to prevent db F5 attacks
        }

        Response.ContentType = "text/xml";

        XmlWriter xml = new XmlTextWriter(Response.Output);
        RssWriter rss = new RssWriter(xml);

        rss.WriteHeader("Bloggat om Piratpartiet", "http://www.piratpartiet.se", "Bloggposter som nämner Piratpartiet", null);

        foreach (MediaEntry entry in entries)
        {
            string title = entry.Title;
            if (title.Length > 30)
            {
                title = title.Substring(0, 27) + "...";
            }

            rss.WriteItem(title, string.Empty, new Uri(entry.Url), entry.DateTime);
        }

        rss.Close();
        xml.Close();
    }
Ejemplo n.º 8
0
        private void write(RssWriter writer)
        {
            try
            {
                if (channels.Count == 0)
                    throw new InvalidOperationException("Feed must contain at least one channel.");

                writer.Version = rssVersion;

                writer.Modules = modules;

                foreach (DSD.Site.UtilityClasses.RSS.NET.RssChannel.RssChannel channel in channels)
                {
                    if (channel.Items.Count == 0)
                        throw new InvalidOperationException("Channel must contain at least one item.");

                    writer.Write(channel);
                }
            }
            finally
            {
                if (writer != null)
                    writer.Close();
            }
        }