More in this section

Forums / Bugs & Issues / Url returned from news api is wrong

Url returned from news api is wrong

6 posts, 0 answered
  1. James
    James avatar
    3 posts
    12 Sep 2007
    25 Jul 2008
    Link to this post
    I have had to create my own RSS feed to get the latest news articles because at the moment the RSS feeds available do not allow you to order them at all.

    Everything has worked as planned until I got the the URL part, I am returned the url of:

    /08-07-23/Launching_the_One_Reading_Central_website (I have to add the .aspx)

    However the official RSS feed and website use the following:


    Now the title of the post is

    "Launching the One Reading Central website!" Which I assume means that all the spaces and characters are replaced by underscores.

    Another thing to note is that in the table "sf_CmsContentBase" the URL stored against the post is the one I am served from the API not the one that the website uses.

    1. Why am I being given the wrong URL by the API
    2. Why is the wrong URL being stored in the database against that news item?

    How can I get the correct URL out into my RSS feed.

    Baring in mind I am hoilday as of the end of the day I could do with a quick reply please.

    Thanks in advance

    P.S if you want to see the code I am using it is this...

    1public void ProcessRequest (HttpContext context) 
    2  { 
    3    context.Response.ContentType = "text/xml"
    4      ShowHeader(context); 
    5      NewsManager newsManager = new Telerik.News.NewsManager("News"); 
    6      // get all news content items 
    7      IList listOfNewsItems = newsManager.Content.GetContent("Publication_Date DESC"); 
    9      if (listOfNewsItems.Count > 0) 
    10      { 
    11          foreach (IContent newsItem in listOfNewsItems) 
    12          { 
    13            //if (newsItem.GetMetaData("Category").ToString().ToLower() == "The Move - Live") 
    14            //{ 
    15              ShowItem(context, newsItem); 
    16            //} 
    17          } 
    18      } 
    20      ShowFooter(context); 
    21    } 
    23    public bool IsReusable { 
    24        get { 
    25            return false
    26        } 
    27    } 
    29    private void ShowItem(HttpContext context, Telerik.Cms.Engine.IContent content) 
    30    { 
    31      context.Response.Write("<item>"); 
    32      context.Response.Write(string.Format("<title>{0}</title>", content.GetMetaData("Title"))); 
    33      context.Response.Write(string.Format("<description>{0}</description>", content.GetMetaData("Summary"))); 
    34      context.Response.Write(string.Format("<link>{0}://{1}{2}</link>", context.Request.Url.Scheme, context.Request.Url.Host, content.Url)); 
    35      context.Response.Write(string.Format("<comments>{0}://{1}{2}</comments>", context.Request.Url.Scheme, context.Request.Url.Host, content.Url)); 
    36      context.Response.Write(string.Format("<guid isPermaLink=\"false\">{0}</guid>", content.ID)); 
    37      context.Response.Write(string.Format("<pubDate>{0}</pubDate>", DateTime.Now.ToString("ddd, dd MMM yyyy hh:mm:ss GMT"))); 
    38      context.Response.Write("</item>"); 
    39    } 
    41    private void ShowHeader(HttpContext context) 
    42    { 
    43      context.Response.Write("<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>"); 
    44      context.Response.Write("<rss version=\"2.0\">"); 
    45      context.Response.Write("<channel>"); 
    46      context.Response.Write("<title>Headline</title> "); 
    47      context.Response.Write("<description>News headlines</description> "); 
    48      context.Response.Write("<link>http://onereadingcentral/newsheadlines.aspx</link> "); 
    49      context.Response.Write("<docs></docs> "); 
    50      context.Response.Write(Environment.NewLine); 
    51    } 
    53    private void ShowFooter(HttpContext context) 
    54    { 
    55      context.Response.Write("</channel>"); 
    56      context.Response.Write("</rss>"); 
    57    } 

  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    25 Jul 2008
    Link to this post
    as far as I know, this is the way the urls are stored in the database. i can't say exactly why, but anytime I program custom stuff, i always have to append .aspx to the retrieved url.
  3. James
    James avatar
    3 posts
    12 Sep 2007
    25 Jul 2008
    Link to this post
    Yea I noticeed that you have to add the .aspx part but it was the fact that one URL had _ at the end and the other one did not. This is what causes an issue.
  4. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    18 Jul 2012
    25 Jul 2008
    Link to this post
    ah okay sorry I guess I didn't fully understand the question! looks like a possible bug to me, I'd recommend playing with the punctuation and see if removing it gives you any insight
  5. Darren
    Darren avatar
    72 posts
    19 Mar 2008
    28 Jul 2008
    Link to this post
    I have a similar issue with news article searches and articles with the ! symbol.
    I've just created an article which I can access with the following link.


    However, the search index always generates the following link.


    So search links break. Incidentally the last _ is for ! in the article title.
    Is there a fix/work around for this?

  6. Georgi
    Georgi avatar
    3583 posts
    28 Oct 2016
    30 Jul 2008
    Link to this post
    Hello Darren,

    We sent a response in the support thread which you opened with the same issue.
    We will do our best to get back to you as soon as we have the requested information.

    Sincerely yours,
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
6 posts, 0 answered