Broken image, retrieve News Content:

Posted by Community Admin on 03-Aug-2018 19:50

Broken image, retrieve News Content:

All Replies

Posted by Community Admin on 04-Oct-2011 00:00

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  

Posted by Community Admin on 06-Oct-2011 00:00

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:

Copy Code
SystemManager.HttpContextItems.Add("sfContentFilters", new string[] "LinksParser" );


Regards,
Vlad
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed