refreshing feed

Apr 18, 2008 at 11:54 PM
Hi,
The refresh method on feed will update only if there are new items.
But we need to keep the feed in memory for it to work.
I have around 200 feeds I have to keep track of and keeping in memory ( say in an array of feeds )
and do a refresh every hour could be a bad strategy.
Also when we re start the app we have to go thru all feeds again for all 200 feeds.

Do you know of any easier way to update feed items more easily and only get items when there are new feeds ?


Apr 19, 2008 at 4:46 AM
Jakkamma,

You can use the lower level support of conditional GET provided within the framework by the SyndicationDiscoveryUtility class (see the overloaded ConditionalGet and TryConditionalGet methods). For a given feed/syndication resource, you would initially retrieve the last-modified and entity tag (eTag) values for an associated URL, and then cache/persist these to be used later to perform a conditional GET operation.
Apr 19, 2008 at 5:51 AM
"you would initially retrieve the last-modified and entity tag (eTag) values for an associated URL,"

Can you give an example
In feed.Channel.LastpublicationDate I always get a 2001 date value for the feeds I am retreiving

I dont know where else I can get correct last-modified date ??
and what is eTag ??

Any small code sample ( even with wrong syntax but with usage of class methods etc will help me.
Thanx
Apr 19, 2008 at 6:11 AM
I saw the example in your SyndicationDiscoveryUtility class and followed it

First time I am able to retreive the

lastModified = webResponse.LastModified;
entityTag = webResponse.HeadersHttpResponseHeader.ETag;

but _entityTag is null as hte response doesnot have this header

Then in a button click I am trying to use this

HttpWebResponse conditionalResponse = Argotic.Common.SyndicationDiscoveryUtility.ConditionalGet(source, lastModified, entityTag);

and it is giving "connection closed error" ( entitytag is null in the arguments)

Is there a reason that before I get webresponse the connection is being closed ??

If required I can send you the URL for the source privately ( need your emailis though )
Thanx
Apr 19, 2008 at 5:44 PM
Jakkamma,

I can always be contacted directly using this CodePlex form. I would suggest reviewing HTTP conditional GET for RSS for an overview of HTTP conditional GET and syndication feeds. The eTag is not always present on some web resources.

I will work on getting a Wiki code example up this weekend that will walk you through what to do.
Apr 21, 2008 at 4:50 AM
Hi,
I have a code I can get to you but using codeplex form is not allowing me to send the link to the sample code ( that is not working for me )
Is there a way you can email me where I can send the sample code ( like your email address or something )

my email is jakkammadusku at yahoo.com

Thanx
Apr 21, 2008 at 5:51 PM
Jakkamma,

I have received your email and link to sample code, lets take this discussion off-line for now. I will use our discussion to create some guidance on the Wiki.
Apr 23, 2008 at 6:58 PM
Created and implemented the Modify conditional GET support to improve modification determination work item feature to improve conditional GET support within the framework. There are cases where some web servers return a 200 status instead of a 304 status when the Last-Modified header provided in the conditional GET request matches the web resources modification date. The new logic still expects/handles the 304 status, but has been improved to compare the LastModified date of the response with the cached modification date provided as part of the conditional GET operation to handle the case where a 200 status is returned but the LastModified date indicates that no change has occurred since the web resource was last retrieved.
Jun 16, 2008 at 4:56 PM
Edited Jun 16, 2008 at 4:57 PM
There is no refresh method on any feed object in the 2008.0.1.0 release. Is it not there anymore or do I miss something obvious?
Jun 16, 2008 at 9:14 PM

The syndication feed implementation was redesigned to decouple peforming a Conditional GET operation (refresh), as this required the feed object carrying/persisting information that was specific to the HTTP transport protocol.

To refresh a syndication feed, you would want to perform the following:

  1. Retrieve the syndication feed from its source and cache the ETag and LastModified values.
  2. Utilize the ConditionalGet or TryConditionalGet methods of the SyndicationDiscoveryUtility static utility class to perform a conditional GET operation using the previously cached eTag and LastModified values to get a HttpWebResponse.
  3. If the conditional GET indicates the syndication feed has been modified, use the HttpWebResponse object to get the response stream to refresh the feed.
  4. Update the cached eTag and LastModified values for the next iteration.
Jun 17, 2008 at 4:00 PM

Hi Oppositional,

Thank you very much for the clarification. Now I got it. 

After some invetigation there are two related issues I need to solve: 

1) Proxy support

For the feed object there is a separate constructor to pass in the proxy information – for the ConditionalGet method there is no such parameter.

At the moment (for testing purposes) I specify the proxy information in my app.config file so I do not run into any issues for now:

  <system.net>
    <defaultProxy useDefaultCredentials="true">
      <proxy proxyaddress="http://myproxy" bypassonlocal="True"/>
    </defaultProxy>
  </system.net>

Later I like to implement proper proxy suport. Maybe the easiest way would be to find a way to modify the above settings at runtime. The other solution would be to not use this configuration at all and pass in the proxy information in the appropriate methods. Do you have any recommendation on this?

2) GenericSyndicationFeed can not be created from a stream

If I like to use a GenericSyndicationFeed for step 3 you mentioned above - this is not possible because it is currently not supported. It would be kind of convinient if the GenericSyndicationFeed can be created from a stream as well.

Jul 1, 2008 at 6:58 PM
The work item 10409 has been opened to add proxy support for conditional GET operations. Work item 9968 has been implemented to support loading of generic syndication feeds from a Stream. Both should be available in the next release.