Wednesday, April 11, 2012

Issue by enabling HTTPOnlyCookies on sharepoint site

HTTPOnlyCookie is enabled by default for Authentication and Sessions cookies in ASP.NET 2.0 but not for manually issued cookies. To enable it for manual issued cookie we need to add following in the web.config.
<httpCookies httpOnlyCookies="true" />

Once we enable the HTTPOnlyCookie on the SharePoint, few things like the default approval workflow for the list will give problem while enablind. We can notice it will add one extra parameter(Infopath_Sentinel=1) in the URL querystring. I am not sure what it is used for, but we cannot create the workflow.

So to avoid this we need te make sure the HTTPOnly cookie need not be enabled from the web.config.

Tuesday, April 10, 2012

Reading RSS feed

Recently while reading the data from the RSS feed, we faced an issue with the RSS not getting updated because of the Header cache. After analysis we found that its because of the caching on client server, we are not able to get the updated data.

To solve this we have tried many options, but the easiest option is to embed the querystring with GUID, which will make sure its always the fresh request.

Following is the sample code

string sSiteUrl = sFeedURL;
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Encoding = System.Text.Encoding.UTF8;
Guid guid = Guid.NewGuid();
sSiteContent = webClient.DownloadString(sSiteUrl+"?guid="+guid.ToString());
webClient.Dispose();