SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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("");

            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
share|improve this question
what error does it generates – Muhammad Raja Feb 14 '13 at 16:53

Most likely, it happens bacause it is impossible to "Create a Web Part that interacts with a Web service or a Windows Communication Foundation (WCF) service." in sandboxed solutions.

As a workaround you can create full-trust proxy.

Some links which could be usefull:

share|improve this answer
thank you for your answer, but you have to put a full trusted proxy into GAC which I am not allowed at all to do it. – user12955 Feb 14 '13 at 20:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.