How do I create an rss feed in ASP.Net? Is there anything built in to support it? If not, what third-party tools are available?
I'm thinking webforms, not MVC, though I suppose since this isn't a traditional page the difference may be minimal.
The .NET Framework 3.5 has added a SyndicationFeed Class which allows you to create and/or consume feeds in Atom 1.0 and RSS 2.0 formats.
SyndicationFeeds Class on MSDN
For built-in, there's nothing stopping you from using XmlDocument or XDocument (3.5) to build up the required XML for RSS. It's more work than it's worth though.
I use the Argotic Syndication Framework and serve the feeds through Generic Handlers (.ashx) with the content type set to text/xml.
The RSSToolkit is also nice. It comes with an RSSDataSource control if you're into that sort of thing. It also includes a control that will automatically insert the meta tag required for feed autodiscovery in browsers. I found the build provider for creating feeds to be a little kludgey however.
Here's an RSS framework created by a Microsoft developer: ASP.NET RSS Toolkit
Use one of the libraries available for generating the actual RSS. For example: http://www.rssdotnet.com/
If you check the code examples page at the bottom:
http://www.rssdotnet.com/documents/code_examples.html
you will find the code for clearing the content type in an ASP.net Page and outputting the RSS.
Something along the lines of (not tested, not compiled, just typed):
public void PageLoad()
{
// create channel
RssChannel _soChannel = new RssChannel();
// create item
RssItem _soItem = new RssItem();
_soItem.Title = "Answer";
_soItem.Description = "Example";
_soItem.PubDate = DateTime.Now.ToUniversalTime();
// add to channel
_soChannel.Items.Add(_soItem.);
// set channel props
_soChannel.Title = "Stack Overflow";
_soChannel.Description = "Great site.. jada jada jada";
_soChannel.LastBuildDate = DateTime.Now.ToUniversalTime();
// change type and send to output
RssFeed _f = new RssFeed();
_f.Channels.Add(channel);
Response.ContentType = "text/xml";
_f.Write(Response.OutputStream);
Response.End();
}
Hope that helps.
You could take a look at Argotic. It is a really cool framework.
http://www.codeplex.com/Argotic
Create an HTTP Handler to create a RSS feed
Related
I've got files with a custom extension .mcsx that are really CSharp files. I want to get code completion on these files in Visual Studio 2012, but these files are treated as plain text when I open them in VS.
I've tried to create a custom MEF extension which allows me to treat the files as having a content-type based on csharp, but I don't get autocompletion or code formatting for these documents. I might need to invoke the custom CSharp classifier for my custom content type, but I'm not sure. Can anyone help?
The custom ContentType is below:
static class ContentType
{
public const string Name = "CSScript";
[Export]
[Name(Name)]
[DisplayName("CSharp Script")]
[BaseDefinition("CSharp")]
public static ContentTypeDefinition CSharpContentType = null;
[Export]
[ContentType(Name)]
[FileExtension(".mcsx")]
public static FileExtensionToContentTypeDefinition CSharpFileExtension = null;
}
Thanks to 'Ego' on the VS forums:
You can add the custom extension file via the way below:
http://blogs.msdn.com/b/zainnab/archive/2010/08/22/using-custom-file-extension-associations-vstipenv0038.aspx
For more information about Registering a Language Service please view:
http://msdn.microsoft.com/en-us/library/vstudio/bb166421(v=vs.110).aspx
So inside of VS things are actually a bit different than the editor APIs imply -- we don't actually use content types (for the most part) to determine when to activate. Noah Richards has a great blog post that shows how to create an extension that marks another extension under an existing editor.
I am trying display the content from taxonomy by using Ektron CMS with ASP .Net
By using the taxonomy path i got the id and trying to display the content.
But i am getting content as null.
Please let me know the possible solutions to solve this.
Waiting for experts answers.
Thanks,
In my development environment, I have the following taxonomy:
const string eventsTaxonomyPath = "\\Upcoming Events";
const long eventsTaxonomyId = 89;
It sounds like you already found this method (or something like it) in what I like to call the "Legacy API":
var taxonomyApi = new Ektron.Cms.API.Content.Taxonomy();
var taxonomyId = taxonomyApi.GetTaxonomyIdByPath(eventsTaxonomyPath);
Without any info on what version you're on, I'll assume it's a recent (8.5+) version. The Framework API makes it really easy to get the content from a given taxonomy. Below are a couple of ways that work on v9.0 and will most likely work in anything 8.5+ -- in the developer briefing webcast the only major change for the Framework API in v9 was the inclusion of the e-commerce namespace.
Getting the full taxonomy tree via the TaxonomyManager:
var taxonomyItemManager = new Ektron.Cms.Framework.Organization.TaxonomyManager();
var taxData = taxonomyItemManager.GetTree(eventsTaxonomyId, includeItems: true);
Getting all the content recursively from a given taxonomy folder via the ContentManager:
var contentManager = new Ektron.Cms.Framework.Content.ContentManager();
var criteria = new ContentTaxonomyCriteria();
criteria.AddFilter(eventsTaxonomyPath, true);
criteria.ReturnMetadata = true;
var content = contentManager.GetList(criteria);
The potential downside to the ContentManager way is that you lose the hierarchical taxonomy structure. The upside to using the ContentManager is that you can tell it to include all the metadata for each content block. That's not possible with the TaxonomyManager or TaxonomyItemManager.
My guess is that the "Get Content By Taxonomy" function you are using by default does not fetch the content. You can either-
a) Use the ID to get the content via the content manager API
b) Investigate if the function you are using has an override to include content.
Recently I have started to work with SSRS and found ReportingCloud. It says
ReportingCloud provides an open source quality implementation
as an extension of the RDL specification
I haven't found any tutorial/documentation on how to use it in sourceforge or via google search.
Can anyone give an walk-through/example on How to use ReportingCloud?
There is one partial example available at http://sourceforge.net/projects/reportingcloud/forums/forum/1116661/topic/4571059.
The example takes an existing RDL file, parses and executes it and then places the HTML output into an asp.net Literal Control for display in the browser.
That code snippet is repeated here:
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("C:\MyFolder\MyReport.rdl");
RDLParser rdlp = new RDLParser(xmlDoc.OuterXml);
rdlp.Parse();
MemoryStreamGen ms = new MemoryStreamGen();
ProcessReport pr = new ProcessReport(rdlp.Report, ms);
pr.Run(null, OutputPresentationType.ASPHTML);
// Dump memory stream (HTML Text) to an out-of-box ASPX Literal control
this.LiteralReportHtml.Text = ms.GetText();
To do this you'll need a reference to ReportingCloud.Engine.
I'm not sure exactly what your bigger goals are but I'd like to draw your attention to another open source project on GitHub called My-FyiReporting https://github.com/majorsilence/My-FyiReporting
Just like ReportingCloud, My-FyiReporting is a fork of FyiReporting (which has gone dormant).
The big difference as far as you are concerned is that My-FyiReporting has ASP.NET samples and an ASP.NET user control link. This might be the fast way to get to what you need.
File ORIGINALPROJECT.TXT from ReportingCloud says:
The ReportingCloud is a fork from the original project fyiReporting
4.1 (http://www.fyireporting.com).
File readme.md from My-FyiReporting says:
My-FyiReporting is a fork of fyiReporting. I cannot stress this
enough. This is a FORK. The main purpose is to make sure that I have a
copy of fyiReporting since that project seems to be dead.
I am new to Ektron & using its 8.6.0 version, I want to create an widget which Import content of selected folder/form in Xliff/XML format (working same as EKtron provide but need to implement in custom widget using code, not in browser), I receive mail from support they tell that "There is a set of API’s that allows you to connect to the language export feature." but I am unable to find any API. Is anyone can help me for this.
I have use following approach but not get any result.
Localization temp = new Localization();
temp.StartExportContentForTranslation("1136,5012,5006", "2057,1031,1041");
Whenever you see a feature in the workarea that you want to emulate, just look at the workarea code. In Workarea\controls\content\localization_uc.ascx.cs, It says
protected Ektron.Cms.LocalizationAPI m_objLocalizationApi = new Ektron.Cms.LocalizationAPI();
protected Ektron.Cms.BusinessObjects.Localization.L10nManager localizationManager = null;
And then calls StartExportContentForTranslation
Please can somebody help to get the first tweet from my twitter and display it on my website.
I am using asp.net 2.0.
Thanks
There are many ways to do this depending on your requirements. Personally, I have accomplished this using the Twitterizer library.
var feed = TwitterTimeline.UserTimeline(new UserTimelineOptions() {
CacheOutput = true,
CacheTimespan = TimeSpan.FromMinutes(1),
ScreenName = "twitter_username",
Count = 1
});
var firstPost = feed.FirstOrDefault();
The advantage of this approach is that you are not required to have a Twitter API key in order to pull the data. It doesn't get much simpler than this!
Update
After you clarified .NET 2.0 I found this .NET 2.0 Twitter API wrapper. Haven't used it myself, but it may be worth a look. Yedda Twitter C# Library
If that that library/wrapper won't do, JSON.NET also has a .NET 2.0 compatible binary.
Just a caveat, JSON.NET would be the most involved simply because the various wrappers that exist will be specialized to Twitter, whereas JSON.NET is just a general JSON parser (Twitterizer even uses it).
In my own opinion, possibly the easiest solution of all is to use jQuery to pull up the API for you. Obviously, that would be done as a client event so it would not be as "ideal" as the alternative. Still it's a the most "no-fuss" solution. Here's a blog post on calling the Twitter API with jQuery.
Take a look at TweetSharp (works on .NET 2.0)
This example doesn't show your tweet, but you get the idea of how easy it is.
using TweetSharp;
TwitterService service = new TwitterService();
IEnumerable<TwitterStatus> tweets = service.ListTweetsOnPublicTimeline();
foreach (var tweet in tweets)
{
Console.WriteLine("{0} says '{1}'", tweet.User.ScreenName, tweet.Text);
}