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

Forums / Bugs & Issues / newsview and expired news

newsview and expired news

5 posts, 0 answered
  1. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    08 Aug 2008
    Link to this post
    okay up til now, this was an annoyance rather than a big issue... If someone tries to view a news item that is expired through the regular news view, they get an "invalid content ID" error. after the news expires, they need to view it through the news archive... Up until now I've just been removing links to the individual news items as they expire so users can't see this error...

    Unfortunately, my users are still finding this news because it's indexed by google! users find these expired news items in google and they try to visit them and they are greeted with an error page! not good!

    Is there any way for the newsview to detect expired items and either redirect to the archive, or at the very least, show the user that the item is expired instead of automatically going into panic mode and throwing an exception?
  2. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    08 Aug 2008
    Link to this post
    Hey well I managed to hack a solution, yay! I caught the exception in the global.asax, and if the request is for news/default/ (current newsview), I redirect to the same url, replacing /default/ with /archive/. Works pretty good, here's the code

        void Application_Error(object sender, EventArgs e)   
        {  
            // DONE IN WEB.CONFIG  
            if (ex.InnerException != null)  
            {  
                if (ex.InnerException.ToString().Contains("Invalid content ID specified"))  
                {  
                    if (Request.RawUrl.Contains("/news/default/"))  
                        Response.Redirect(Request.RawUrl.Replace("/default/""/archive/"), true);  
                }  
            }  
         } 

    hope that this helps somone out!
  3. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    08 Aug 2008
    Link to this post
    Hello SelArom,

    I am very glad that you were able to find the workaround for the issue. It is really a serious issue and I have logged it in, so we will see how to provide a built in flexible solution for handling these kind of problems.

    Thank you for posting the code. I have updated your points.

    Greetings,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  4. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    08 Aug 2008
    Link to this post
    many thanks, but i have a small followup, is there a way to have this code "handle" the error, so that an error report isn't generated? People are still accessing these links, and though they are correctly redirected, I still get error reports in my email inbox. I'd like to eliminate these if possible.

    I tried to google it but I can't find anything that will allow me to resolve the exception as handled. is global.asax too late to do this?

    thanks!
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Aug 2008
    Link to this post
    Hello SelArom,

    The only way to handle these errors is to override the ContentView and the dependent controls.
    We are sorry for the inconvenience.

    All the best,
    Georgi
    the Telerik team

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