I am using following code in a Web Part to read Rss (atom). Same Web Part works in Farm Solution but generates error (don't know what) in a Sandbox solution.
WebClient wc = new WebClient();
wc.Credentials = new NetworkCredential("myuserName", "myPassword");
IEnumerable<myClass> feeds = null;
using (System.IO.Stream stream = wc.OpenRead(myfeed))
{
XDocument d = XDocument.Load(stream);
XNamespace ns = XNamespace.Get("http://www.w3.org/2005/Atom");
feeds = d.Root.Descendants(ns + "entry").Select(e =>
new myClass
{
Title = e.Element(ns + "title").Value,
Description = e.Element(ns + "summary").Value,
Link = e.Element(ns + "link").Value
});
}
foreach (Rss item in feeds)
{
//render items
}