1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Broken image, retrieve News Content:

Broken image, retrieve News Content:

2 posts, 0 answered
  1. Taha
    Taha avatar
    1 posts
    Registered:
    14 Apr 2011
    04 Oct 2011
    Link to this post
    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  
  2. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    06 Oct 2011
    Link to this post
    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
2 posts, 0 answered