在 MVC 视图中读取 RSS
我想将 RSS 数据加载到视图中,但不知道从哪里开始。 下面是示例 Feed URl: http://rss.cbc.ca/lineup/topstories.xml
我该如何使用上面的 url 并在视图中显示新闻?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想将 RSS 数据加载到视图中,但不知道从哪里开始。 下面是示例 Feed URl: http://rss.cbc.ca/lineup/topstories.xml
我该如何使用上面的 url 并在视图中显示新闻?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
.NET Framework 中内置了一些类来读取和生成 RSS 提要(在 System.ServiceModel.Syndicate 命名空间下查看)。
这是一篇关于该主题的好文章:
http://www.dotnetbips.com/articles/addaf09f-9b6b-45d2-aba8-da11f23aa53e.aspx
更新: 我假设您正在使用 ASP.NET MVC 但后来我意识到你没有指出你正在使用什么 MVC 框架,希望它是 ASP.NET MVC,否则我的答案将毫无用处。
There are some classes built-in the .NET Framework to read and produce RSS feeds (look under the System.ServiceModel.Syndication namespace.
This is a good article on the subject:
http://www.dotnetbips.com/articles/addaf09f-9b6b-45d2-aba8-da11f23aa53e.aspx
Update: I assumed you are using ASP.NET MVC but then I realized you don't indicate what MVC framework are you using. Hope it was ASP.NET MVC otherwise my answer would be useless.