Blog in application - how to make rss feeds private?

Ayende writes an interesting post about the how idea of having a blog incorporated in your application can be a clever idea.

I have been thinking of this concept myself for a admin system I am developing. I think that a rss feed would be very handy but havn't been able to figure out how to make it private. Think I read somewhere about a way to put password on a feed, but some of the big rss readers does not support it yet (for example Google Reader).

One of the commenters to Ayende's post gave me a tip worth checking out. Unfortunatly it only works in Outlook / IE.

If you want to make RSS feeds private the easiest way (that works with Outlook at least) is to enable HTTP Basic Authentication and visit the RSS feed with IE to input credentials and check the option to save them. Then Outlook will transparently use those credentials to update the feed.
By Jesper Lind

Create Flex-apps with online compiler

Flex is really a cool concept that makes development of flash-applications a lot easier. If you wanna se what it's all about before buying the software, there is a online compiler avalible.

Start from scratch and write MXML- and ActionScript-cod, or start with the examples. When you are ready there are a button to get the code emailed to you directly. Below there's an exampel of an RSS-reader that I made.

Bear in mind that you can't enter any RSS-feed because of the sequrity settings in the flash-player. And for some reason my feed on the english version wouldn't work, so the app loads my swedish feed.

 

 

By Jesper Lind

Create a RSS-feed

RSS is getting popular and is a great way to let the users subscribe to the content of your web site. This is how you create an feed in Asp.Net.

//Funktion som skapar RSS flöde
protected void GenerateRss()
{
try
{

//Fysisk sökväg på servern (Byt ut mot den på din server)
string strXMLPath = "C:/ . . . /rss.xml";

FileStream objFileStream = new FileStream(strXMLPath,FileMode.Create);
XmlTextWriter xtw = new XmlTextWriter(objFileStream,System.Text.Encoding.GetEncoding("iso-8859-1"));
xtw.Formatting = Formatting.Indented;
xtw.WriteStartDocument();

//skriv ut <rss version="2.0">
xtw.WriteStartElement("rss");
xtw.WriteAttributeString("version","2.0");

//skriv ut <channel>
xtw.WriteStartElement("channel");

//skriv ut element som tillhör <channel>
xtw.WriteElementString("title","Codeodyssey.se");
xtw.WriteElementString("link","http://www.codeodyssey.se/");
xtw.WriteElementString("description","Code Odyssey - expanderar webben");
xtw.WriteElementString("language","sv-SE");
xtw.WriteElementString("copyright","Copyright (c) 2004-2006 Code Odyssey");

OleDbConnection conn = new OleDbConnection (strConn);
bool boolPermission = false;
OleDbDataReader objDataReader=null;
try
{
string strSQL = "SELECT Blog.Id, Blog.Title, Blog.Body, Blog.PublishDate FROM Blog ORDER BY Blog.PublishDate DESC";

conn.Open();

OleDbCommand objCommand = new OleDbCommand(strSQL, conn);
objDataReader = objCommand.ExecuteReader();
while (objDataReader.Read() == true)
{
int Id = Convert.ToInt32(objDataReader["Id"]);
string Title = Convert.ToString(objDataReader["Title"]);
string Body= Convert.ToString(objDataReader["Body"]);
//Se till att datum följer RFC-822 standard
string PublishDate = Convert.ToString( ((DateTime)objDataReader["PublishDate"]).ToString("r"));


//skriv ut <item> och dess innehåll
xtw.WriteStartElement("item");
xtw.WriteElementString("title",Title);
xtw.WriteElementString("link","http://www." + strUrl.ToLower() + "/Blog.aspx?id=" + Id);
xtw.WriteElementString("guid","http://www." + strUrl.ToLower() + "/Blog.aspx?id=" + Id);
xtw.WriteElementString("description",Body);
xtw.WriteElementString("pubDate",PublishDate);
xtw.WriteEndElement();
}
objCommand.Dispose();
}
catch (Exception objException)
{
Trace.Warn("GenerateRss() Fel!",objException.Message);
}
finally
{
if(objDataReader!=null)
{
objDataReader.Close();  
}
onn.Close();
}

//skriv ut </channel>
xtw.WriteEndElement();

//skriv ut </rss>
xtw.WriteEndElement();

//Stäng xml skrivaren
xtw.Close();
}
catch (Exception objException)
{
Trace.Warn("GenerateRss() Fel!",objException.Message);
}
}

This is how to add the icon in the browser.

<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="xml/rss.xml" />

This is how to add such a link from the code behind:

//Add RSS link HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "application/rss+xml");
link.Attributes.Add("rel", "alternate");
link.Attributes.Add("href", "feed/rss.xml");
this.Page.Header.Controls.Add(link);

By Jesper Lind
1