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

Forums / Deployment / News Module Page Cannot Be Found error after upload

News Module Page Cannot Be Found error after upload

13 posts, 1 answered
  1. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    28 Feb 2010
    Link to this post
    Howdy,

    I just deployed my Sitefinity site into production and everything is working fine except the news module. I'm using the ListPageDetails and ListPageMaster custom control templates along with Gabe Sumner's custom news user control code as described in his "Getting Started with Sitefinity 3.6" video. When I click on a news item title href link to go to the Details, it errors with a 404 page cannot be found.

    It works fine running locally though, so I'm a little stumped. Any help would be greatly appreciated.

    Thank you,

    Scott 
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    28 Feb 2010
    Link to this post
    Hello Scott MacDonald,

    Check whether you use a page prepared to hold the full info, but there is no NewsView control on it. You can also compare the link you have when you click on the title and the value entered in the database - [sf_CmsContentBase] table LoweredUrl column.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    01 Mar 2010
    Link to this post
    Hi Ivan,

    Thank you for responding. I have a "news" page that I created, and have the newsview control on. I have custom control templates configured in it of:

    SingleItemTemplatePath: ~/Custom/ControlTemplates/News/ListPageDetails.ascx
    ItemListTemplatePath: ~/Custom/ControlTemplates/News/ListPageMaster.ascx

    The LoweredURLs in the database do not match up with the URL of the news items in the list. The difference is that in the URL of the items in the list there is an extra directory in the path of /news, I'm assuming because of the control template path above. So for instance, a LoweredURL in the DB is:

    /10-02-20/<title of one of my news items>

    and the URL of the link on the page is:

    /news/10-02-20/<title of one of my news items>

    Even when I remove the /news from the URL path in my browser address bar trying to match it up with the LoweredURL in the DB it still does not work. Is there a setting I'm just missing? Like I mentioned before, it's odd because it works fine when running locally on my PC during development. The only difference is that I pushed it up to the webserver into production.

    Thanks again for the help.

    Scott
     
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Mar 2010
    Link to this post
    Hi Scott MacDonald,

    The urls are correct.

    /10-02-20/<title of one of my news items>
    - this line  from the database does not include the page where the control resides - in your case "news". The content item does not know where NewsView control will be dropped so the url is correct.

    Since this work on the locahost, there must be something in the IIS server that prevents the item from opening properly. It seems that some setting blocks UrlRewriterService (something like the problem described in this KB). Do you have the same problem with other controls like BlogPosts, ContentView, EventsView.  This will help you to narrow down the issue - whether it comes only from NewsView control and News provider or it affects the UrlRewriterService and all ContentView based controls.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    01 Mar 2010
    Link to this post
    Hi Ivan,

    This is actually my first Sitefinity site and so the first time I've attempted to use these controls. I haven't had the chance to try the other controls like the Blogs, etc...

    I will try adding the KB and see if that works.

    Scott
  6. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    01 Mar 2010
    Link to this post
    Hi Ivan,

    I added the code to the custom news control and it doesn't seem to be helping. I recycled the application pool in IIS but that didn't help either. Is there any specific settings in IIS that you know about that I can try?

    Thanks,

    Scott
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Mar 2010
    Link to this post
    Hi Scott MacDonald,

    Have you tried using another control as suggested? Try setting this line in the web.config

    <system.webServer>
      <modules runAllManagedModulesForAllRequests="true">


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  8. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    01 Mar 2010
    Link to this post
    Hi Ivan,

    I created a test blog and it worked fine. I guess it has to do with either the custom news user control or external templates then. I was using Gabe's news user control and external templates because on my home page I have a box in the right side bar where I wanted news headlines to automatically show up, and then when a user clicks one it would take you to the full detail of the news article. I couldn't figure out how to do that with the stock news control.

    I couldn't get that web.config setting you mentioned to work. It complained of a syntax error, are you sure it's the correct format?

    Thanks again, and if you have any other suggestions it would be greatly appreciated.

    Scott
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Mar 2010
    Link to this post
    Hello Scott MacDonald,

    1.Send the custom control you use.

    2.runAllManagedModulesForAllRequests  is in the correct format. This is standard web.config attribute.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  10. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    01 Mar 2010
    Link to this post
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="News.ascx.cs" Inherits="Custom_UserControls_News" %>
     
    <div>
        <h2>News @ Funi</h2>
        <asp:Repeater ID="NewsRepeater" OnItemDataBound="NewsRepeater_OnItemDataBound" runat="server">
            <HeaderTemplate>
                <ul>
            </HeaderTemplate>
            <ItemTemplate>
                <li><a id="Link" runat="server"></a></li>
            </ItemTemplate>
            <FooterTemplate>
                </ul>
            </FooterTemplate>
        </asp:Repeater>
    </div>
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using Telerik.Cms.Engine;
    using Telerik.Cms.Engine.Data;
     
    [Telerik.Web.UrlRewriterService("Telerik.Cms.Engine.ContentUrlRewriterService, Telerik.Cms.Engine")]
    public partial class Custom_UserControls_News : System.Web.UI.UserControl
    {
        private int numberofitems = 5;
     
        /// <summary>
        /// This is the number of "What's New" items we will display.
        /// </summary>
        public int NumberOfItems
        {
            get
            {
                return numberofitems;
            }
            set
            {
                numberofitems = value;
            }
        }
     
        protected void Page_Load(object sender, EventArgs e)
        {
            ContentManager cm = new ContentManager("News");
            IList RecentlyUpdated = cm.GetContent(0, numberofitems, "Publication_Date DESC");
     
            IList<LinkInfo> WhatsNewLinks = new List<LinkInfo>();
     
            foreach (CmsContentBase article in RecentlyUpdated)
            {
                LinkInfo linkinfo = new LinkInfo();
                linkinfo.Title = article.GetMetaData("Title").ToString();
                linkinfo.Url = article.Url;
                WhatsNewLinks.Add(linkinfo);
            }
     
            NewsRepeater.DataSource = WhatsNewLinks;
            NewsRepeater.DataBind();
        }
     
        protected void NewsRepeater_OnItemDataBound(Object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item ||
                e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HtmlAnchor itemLink = (HtmlAnchor)e.Item.FindControl("Link");
                LinkInfo linkinfo = (LinkInfo)e.Item.DataItem;
                itemLink.HRef = "~/news/" + linkinfo.Url;
                itemLink.InnerText = linkinfo.Title;
            }
        }
     
        protected class LinkInfo
        {
            public string Url;
            public string Title;
        }
    }
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    01 Mar 2010
    Link to this post
    Hello Scott MacDonald,

    The main problem is that you are setting itemLink.HRef = "~/news/" + linkinfo.Url; where you have to use UrlWithExtension. Also you use Data classes like CmsContentBase instead of working with interfaces as IContent. Also it is better to subscribe for ItemDataBound event of the Repeater in Page_Load.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
    Answered
  12. Scott MacDonald
    Scott MacDonald avatar
    29 posts
    Registered:
    08 Mar 2006
    03 Mar 2010
    Link to this post
    Hi Ivan,

    Thanks for pointing me in the right direction. I will continue to look into that. As a temporary workaround I changed:

    itemLink.HRef = "~/news/" + linkinfo.Url;

    to be:

    itemLink.HRef = "~/news/" + linkinfo.Url + ".aspx?CntPageID=1";

    It's a hack I know, but atleast it will keep my news page on my production site from blowing up until I can research more into your suggestions. Thanks again,

    Scott
  13. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    03 Mar 2010
    Link to this post
    Hello Scott MacDonald,

    I suggest that you should use public properties that can be edited from the control designer, otherwise you will need to change the code when you want to make any change.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
13 posts, 1 answered