RSS 2.0 Feed

Apr 2, 2008 at 8:10 PM
Edited Apr 2, 2008 at 8:11 PM
I've created an XML Control that consumes and displays an RSS 2.0 Feed. The code works when I point to an external rss feed, but I get a (401) Unauthorized message when I try to point at the syndication.axd file inside my blog. Am I missing something? Thanks.

<%@ Page Language="C#" %>
<%@ OutputCache Duration="3600" VaryByParam="none" %>

<script runat="server">
private void Page_Load(object sender, EventArgs e)
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load("http://netdev:9568/syndication.axd");
xmlRss.Document = doc;
xmlRss.TransformSource = "rss.xsl";
}
</script>

<html>
<head>
</head>
<body>
<form id="Form1" runat="server">
<asp:xml id="xmlRss" runat="server" />
</form>
</body>
</html>
Apr 23, 2008 at 3:05 PM
Here's the correct syntax:

System.Xml.XmlUrlResolver resolver = new XmlUrlResolver();
resolver.Credentials = System.Net.CredentialCache.DefaultCredentials;
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.XmlResolver = resolver;
doc.Load(<URL for the .axd file>);
xmlRss.Document = doc;
xmlRss.TransformSource = "rss.xsl";