2

I am trying to read an rss feed from my MVC application. The code works fine when I run it at home, however when I run my local machine at work, or on IIS 7, it fails. I suspect that this is a proxy setting problem, however I have tried modifying the config file to use the default proxy, and in any case understood that IIS went with the IE settings - and I can connect to the internet from the webserver.

The code to access the rss feed is as follows:

    public static List<string> ReadDangerZoneFeed()
    {
        XmlReader reader = XmlReader.Create("http://rssfeedaddress.rss");
        SyndicationFeed feed = SyndicationFeed.Load(reader);

        reader.Close();

        List<string> _DangerZones = new List<string>();

        foreach (var Item in feed.Items)
        {
            _DangerZones.Add(Item.Title.Text);
        }

        return _DangerZones;
    }

The error message occurs ar the XMLReader.Create line and is "Unable to connect to the remote server". I'd very much appreciate any advice,

Many thanks,

Jamie

majjam
  • 1,286
  • 2
  • 15
  • 32

1 Answers1

1

It turns out all I needed to do was get the specific sites whitelisted on our company proxy. I then added the proxy details to the web.config file as per this answer Is it possible to specify proxy credentials in your web.config? and it all works fine.

Community
  • 1
  • 1
majjam
  • 1,286
  • 2
  • 15
  • 32