I'm trying to build a SharePoint 2013 webpart who read an authenticated RSS feed from a blog post library.
My webpart and blog post library are inside the same SharePoint Web application and site collection on the same server (so I think don't have a Kerberos or dual hoop authentication problem)
The code used for reading the feed is:
System.Xml.XmlDocument _result = new System.Xml.XmlDocument(); System.Net.WebRequest request = System.Net.WebRequest.Create(url); request.Method = "GET"; request.Credentials = System.Net.CredentialCache.DefaultCredentials; System.Net.WebResponse response = request.GetResponse(); _result.Load(response.GetResponseStream()); response.Close();
The url is the RSS feed of the library:
http:///<web>/Blog/_layouts/15/listfeed.aspx?List={B7D32B09-26E3-4F82-A82B-5AC7F7D40C7D
Now:
1. If I open the url in the browser all work fine
2. If I use the System.Net.CredentialCache.DefaultCredentials or System.Net.CredentialCache.DefaultNetworkCredentials I receive only the <channel> part of the feed but not the item. (in this case if I check with the Visual Studio 2012 debugger I see all the filed empty in the Credentials object)
3. If I use new System.Net.NetworkCredential(<domain\user>,<password>) all work fine
4. If I run the with elevated privileges (RunWithElevatedPrivileges) all work fine
I would read the RSS feed with the logged user credentials.
Where is my mistakes?
Thnaks
Lorenzo Soncini
LSo Lorenzo Soncini Trento TN - Italy