Fails reading Google Bookmarks RSS using .NET

白昼怎懂夜的黑 提交于 2019-12-12 03:37:57

问题


Hi I am experiencing weird problem. I want to consume Google Bookmarks RSS in my .NET application. Here is the code:

string rssUrl = "https://www.google.com/bookmarks/?output=rss";
NetworkCredential credentials = new NetworkCredential("myusername", "mypassword");
XmlUrlResolver resolver = new XmlUrlResolver { Credentials = credentials };
XmlReaderSettings settings = new XmlReaderSettings { XmlResolver = resolver };
XmlReader reader = XmlReader.Create(rssUrl, settings);
XDocument document1 = XDocument.Load(reader); // Fails here

When I open rssUrl in browser I see all my bookmarks as RSS feed prefectly. When I run this code, it fails. In fact, what is returned back is the Google SignOn page instead of the RSS.

Using exactly the same code I can read Gmail RSS no problem.

But not Google Bookmarks RSS. This doesn't make any sense to me. It should be straight forward and very simple.

Please advice. Thanks a bunch.

来源:https://stackoverflow.com/questions/12408232/fails-reading-google-bookmarks-rss-using-net

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!