More in this section
Forums / Developing with Sitefinity / 4.2 BlogPost URL Problems

4.2 BlogPost URL Problems

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Chad
    Chad avatar
    9 posts
    04 Oct 2012
    03 Oct 2011
    Link to this post
    Hello, I am currently in the process of migrating a Sitefinity 3.7 project to 4.2, and have run into an issue while rewriting parts of a widget.

    In short, it gets the last X comments for blog posts. That part I have squared away just fine, but I am having problems trying to link to the blog post.

    If I am to do:
    blogPost.Parent.Urls.Where(x => x.RedirectToDefault == false).First().Url + blogPost.Urls.Where(x => x.RedirectToDefault == false).First().Url

    I get /Back_to_School_Tips/10-07-30/Back_to_School_Tips.aspx

    What I am EXPECTING back is /multimedia/forums/Back_to_School_Tips/10-07-30/Back_to_School_Tips.aspx

    Because the "back to school tips" blog is under the forums page which is a child of the multimedia page.

    Is there something simple I'm just not getting? I've spent most of today searching for an answer to this problem. It seems silly that there wouldn't be an easy way for me to get back the entire URL.
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    05 Oct 2011
    Link to this post
    Hi dustin,

    Have you already set a default page in the parent blog settings? If so, you can retrieve this property using the property: DefaultPageId

    something like this should work

    var blogPageId = blog.DefaultPageId;
    var landingPage = App.WorkWith().Pages().Where(p => p.Id == blogPageId).Get().Single();
    var blogUrl = landingPage.GetFullUrl();

    be sure to include the namespace Telerik.Sitefinity.Module.Pages to be able to use the GetFullUrl extension method.

    hope this is helpful!
2 posts, 0 answered