public WriteHeader ( string title, string link, string description, string generator ) : void | ||
title | string | |
link | string | |
description | string | |
generator | string | |
return | void |
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); } } }
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(); }
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(); }
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(); }
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(); }