Hello!

I'm building an ASP.NET portal with C# codebehind. I'd like to include an RSS feed too. The main idea is that when you write an article, it's inserted into an SQL database, and in the same moment, it'd update the rss xml file.

My question is: how can I insert a whole item (title, description, link, imageurl, etc) to the rss feed, before the first item (so that the first would be the second, etc.)

Thanks in advance!

You should probably recreate the RSS .xml file from the database after you do any inserts, updates, or deletes to the SQL table. It is too error prone to try "add here, and, add here" .. then "update here, and, update here" .. over time they will get desynched.

If this is not an acceptable solution let me know and I will look in to another solution. As far as file I/O goes if you insert something to the top of a file it has to push all of the contents downstream on the disk, so you will have the same amount of IO either way... but adding single entries to the .RSS file will be error proned as I mentioned.

Also when RSS feeds get too big I believe most people split them up in to multiple files, or, start excluding old entries. Recreating the files after updates would give you the flexibility to do whatever you want to the files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.