Hi, this is a bit of a strange one.
I have my front page of my intranet site and I am trying to pull an RSS feed from a subdirectory forum.
Root
Default.aspx
—>Forum
—>Rssfeed.aspx
On my default.aspx I can pull RSS Feeds from the BBC or any other external website so my code is working fine but when I try and pull a RSS feed from my local server I get “The remote server returned an error: (401) Unaithorized”.
Now, if I go to the Forum directory within IIS and change the directory secutiry from “Integrated Windows Authentication” to “Enable anonymous access” the RSS comes through to the front page without any errors, however, the forum requires “Integrated Windows Authentication” to be enable to that my users can post on the forum. If I turn both on then Windows authentication is still ignored for my users when they visit the forum.
I have hardcoded my credentials in to the Default.aspx.cs to see if that helps but I still get Unauthorized message.
My code is here:
view plaincopy to clipboardprint?
XmlTextReader reader;
WebRequest wrq;
string url;
url = "http://myscs.scotcourts.local/forum/topics.aspx?ForumID=9&rss=1";
wrq = WebRequest.Create(url);
wrq.Proxy = WebProxy.GetDefaultProxy();
//wrq.Proxy.Credentials = new System.Net.NetworkCredential("myUserName", "myPassword");
wrq.Credentials = new NetworkCredential("myUserName", "myPassword", "myDomain");
//wrq.Credentials = CredentialCache.DefaultCredentials;
try
{
reader = new XmlTextReader(wrq.GetResponse().GetResponseStream());
DataSet forumds = new DataSet();
forumds.ReadXml(reader, XmlReadMode.Auto);
rssForumDG.DataSource = forumds.Tables["item"];
rssForumDG.DataBind();
}
catch (Exception ex)
{
lblMessage.Text = ex.Message.ToString();
}
As you can see I have tried a couple of different ways to get the credentials to work, it just seems to ignore my credentials and I have full admin access to the server and when I visit the forum it picks up my username.
One option is that its trying to go via the Proxy but the RSS is on the same server so I dont need it to go out via the proxy, I just need the page to read the rss feed which is only a directory away!
Can anyone help please,