Broken image, retrieve News Content:
Hi,
Am retrieving a news content with the following code,
var news_item = App.WorkWith().NewsItems()
.Where(nI => nI.UrlName == strArticleUrl)
.Where(nI => nI.Status == Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
.OrderBy(nI => nI.DateCreated)
.Get().Single();
Literal1.Text = news_item.Content;
The problem is that images don't show . But show broken like this instead :
<img alt="" src="[images]5c9ccf74-f01c-4853-a822-cc61b790de9d?Status=Master">
How can I retrieve the content with the images correctly showing. I already searched around and tried to use
Literal1.Text = Telerik.Sitefinity.Web.Utilities.LinkParser.ResolveLinks(news_item.Content) . Which gives me a NotImplemented error .
I also went to this page http://www.sitefinity.com/blogs/georgichokov/posts/09-07-02/resolving_the_url_of_dynamic_links.aspx
and the code there didn't help me. I feel that this should be very intuitive as it's a very basic requirement !
Thanks for ur help
Hello Taha,
The blog post you linked is for Sitefinity 3.x. In 4.x resolving dynamic links is automated if you are using a page generated by Sitefinity.
Most probably you are trying to retrieve the news content in a non-sitefinity page, i.e. standard .ASPX page. In this case, you are missing the content filter in the Context of the page.
Add the following code on Init of the page:
SystemManager.HttpContextItems.Add(
"sfContentFilters"
,
new
string
[]
"LinksParser"
);