tags:

views:

235

answers:

3

i want to know can we make application in c# donet in which we can show rss feed directly in a form or can we make widgets . And for every update there should be notification to user.although iam showing rss feed by just showing the web page of rss feed.

+1  A: 

Create a timer that will check the RSS at regular intervals, if the latest items "pubDate" isn't the same as the last item you received, then all of the items that are of a later date/time of the most recent item you received will require a notification.

ThePower
but how can i check the content of page containing rss feed . how can i store the content
banita
The content of an rss feed is in the form of XML, I suggest you check it out if you're unsure http://en.wikipedia.org/wiki/RSS
ThePower
A: 

Mabye this will help you: http://rss-net.sourceforge.net/ You can see exaples here: http://www.rssdotnet.com/documents/code_examples.html

I think you are looking for something that will help you with manipulating data from RSS feed. But I might be wrong ;)

Maby you won't need any additional libs: http://predicatet.blogspot.com/2008/11/read-rss-or-atom-feed-natively-with-c.html

Jarek
A: 

here is my code for my blog you can visit here

  public XmlDocument GetRss(int count)
    {
        XmlDocument xml=new XmlDocument();
        XmlElement root,chn,elm;
     xml.AppendChild(xml.CreateXmlDeclaration("1.0", "utf-8", "yes"));
     root = xml.CreateElement("rss");
     root.SetAttribute("version", "2.0");
     xml.AppendChild(root);

     chn = xml.CreateElement("channel");
     root.AppendChild(chn);

     elm = xml.CreateElement("title");
        elm.InnerText = System.Web.Configuration.WebConfigurationManager.AppSettings["sitename"];
     chn.AppendChild(elm);

     elm = xml.CreateElement("link");
        elm.InnerText = System.Web.Configuration.WebConfigurationManager.AppSettings["host"];
     chn.AppendChild(elm);

     elm = xml.CreateElement("description");
        elm.InnerText = System.Web.Configuration.WebConfigurationManager.AppSettings["sitedes"] ;
        chn.AppendChild(elm);


        List<Blog> blogs = BlogManager.Instance.GetBlogLists(count);
        foreach (Blog bg in blogs)
        {
            Blog blog=BlogManager.Instance.ReadBlog(bg.keyword,bg.path);
            if (blog.encryption.Trim() == string.Empty)
            {
                XmlElement item = xml.CreateElement("item");
                chn.AppendChild(item);
                elm = xml.CreateElement("title");
                item.AppendChild(elm);
                elm.InnerText = blog.title;

                elm = xml.CreateElement("pubDate");
                item.AppendChild(elm);
                elm.InnerText = blog.pubdate.ToString("r");

                elm = xml.CreateElement("link");
                item.AppendChild(elm);
                elm.InnerText = System.Web.Configuration.WebConfigurationManager.AppSettings["host"] + "Blog/"+bg.path+"/" + blog.keyword + ".esp";

                elm = xml.CreateElement("description");
                item.AppendChild(elm);
                elm.AppendChild(xml.CreateCDataSection(blog.description));

                elm = xml.CreateElement("guid");
                item.AppendChild(elm);
                elm.InnerText = System.Web.Configuration.WebConfigurationManager.AppSettings["host"] + "Blog/" + bg.path + "/" + blog.keyword + ".esp";
                elm.SetAttribute("isPermaLink", "false");
            }

        }
        return xml;

    }

you can set it into a IHttpHandler form

using System; using System.Web; using Edwin.Web; using Edwin.Object; using System.Collections.Generic; public class Rss : IHttpHandler {

public void ProcessRequest (HttpContext context) {
    if (context.Request.RawUrl.ToLower().Trim().IndexOf(".ashx") != -1) context.Response.Redirect(context.Request.RawUrl.Replace(".ashx", ".esp"));
    context.Response.AddHeader("Cache-Control", "no-cache");
 context.Response.ContentType = "text/xml; charset=utf-8";
    Edwin.Web.BlogManager.Instance.GetRss(20).Save(context.Response.OutputStream);

}

public bool IsReusable {
    get {
        return false;
    }
}

}

Edwin Tai