Reputation: 1462
GetProductData return correct image url but in my ashx page it doesn't appear. Can anybody help me?
List<ProductItem> p = ProductFactory.GetProductData();
foreach (ProductItem c in p)
{
rss.WriteStartElement("item");
rss.WriteElementString("title", c.Page_Title);
rss.WriteElementString("link", HttpUtility.HtmlEncode(BaseSiteUrl + c.Page_Url.Replace("~", "")));
rss.WriteElementString("description", c.Page_Description);
rss.WriteElementString("pubDate", DateTime.Now.ToString());
//object pho_url = ProductFactory.GetProductImageUrl(c.ProductID);
//How can i add image element here...
rss.WriteElementString("guid", "guid field");
rss.WriteEndElement();
}
Upvotes: 0
Views: 4323
Reputation: 348
RSS 2.0 includes the optional 'enclosure' element. You could use that. According to the definition it
describes a media object that is attached to the item
Upvotes: 1
Reputation: 524
Generally it's done in it's own namespace, here's an example from techcrunch's feed.
<media:content url="http://www.mobilecrunch.com/wp-content/uploads/2011/01/iphone3gs11.jpg" medium="image">
<media:title type="html">iphone3gs11</media:title>
</media:content>
Then you'll need to add the namespace as an attribute on <rss>
xmlns:media="search.yahoo.com/mrss/"
This is what I believe apps like pulse and flipboard try to use for there visual readers.
Upvotes: 2