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

Forums / General Discussions / question on new changes in sp2

question on new changes in sp2

4 posts, 0 answered
  1. Jiri
    Jiri avatar
    3 posts
    Registered:
    12 Mar 2008
    06 Jun 2008
    Link to this post
    Hello,

    in latest downloads I cannot find any detailed description of some new changes

    for example:

    What’s New:
    -   Added an option to throw 404 exception when a page language version is missing


    Where can I find this option?

    I have created only one version (english) of my page "somepage.aspx" but when I place a language bar on the page and click on "deutsch" version I will be redirected to "de/somepage.aspx" with english content. I need to get 404 or custom error page which is saying something like "Sorry language version is not available. Click to deutsch home page or english version of page". How to do this?

    Is an updated developer manual available for sp2?

    Thanks for response
    Jiri
  2. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    09 Jun 2008
    Link to this post
    Hi Jiri,

    You need to set the following attribute in the application web.config file:

    <cms defaultProvider="Sitefinity"   
    pageExtension=".aspx"   
    disabled="false"   
    useStrictLanguageVersions="true"   
    pageEditorUIMode="Overlay">  
    <providers> 

    When you access http://yoursite.com/de/page.aspx and you don’t have German version of the page.aspx, an HTTP 404 error page is shown.
    The error message is: “Invalid Page language version request! The requested page does not contain a definition for the requested language.”

    In page preview  mode, the content will be displayed in the default language. 

    To set a custom error page, you need to create the ~/Sitefinity/NoLanguageVersion.aspx first and edit the web.config as shown below.
        <customErrors mode="RemoteOnly">
          <error redirect="~/Sitefinity/NoLanguageVersion.aspx" statusCode="404" />
        </customErrors>

    Let us know if you need any further assistance.

    All the best,

    Rebecca
    the Telerik team


    Instantly find answers to your questions at the new Telerik Support Center
  3. Jiri
    Jiri avatar
    3 posts
    Registered:
    12 Mar 2008
    10 Jun 2008
    Link to this post
    Hi Rebecca,

    thank you for advise.

    The problem now is that ALL 404 responses will be redirected to NoLanguageVersion.aspx and it is not good way. We need to inform user with message like that "German version is not available. Click back, to english version or german home page." I think this is the best way. (english version or first version defined by priority/order taken from web.config) (probably every language version will have at least home page defined.)
    If I could handle in global.asax some specific exception eg. NoLanguageVersionException rather than only HttpUnhandledException, then I would provide a redirect  by my own to my error page with query I need to generate the error text (it should contain request url - /de/somepage.aspx ).

    Other solution for me could be to check every reguest in App_BeginRequest, look to sitemap current node and execute
    HasLanguageVersion method and raise my exception or do a redirect.

    Also do you have some solution with language bar without using postabacks because I donť know why you are using it. Is there a hidden logic behind?
    We dont want javascripts and postbacks on our site if  it is not really needed.

    thank you

    Jiri
  4. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    12 Jun 2008
    Link to this post
    Hello Jiri,

    You are right about this limitation, so we'll provide a fix for it in the upcoming hotfix.
    Here is what you will be able to do once you apply the hotfix.

    void Application_Error(object sender, EventArgs e)   
        {  
            Exception ex = Server.GetLastError();  
            if (ex is HttpException)  
            {  
                Telerik.Cms.Exceptions.NoPageLanguageVersionHttpException httpEx = ex.InnerException as Telerik.Cms.Exceptions.NoPageLanguageVersionHttpException;  
                if (httpEx != null   
                    && httpEx.GetHttpCode() == 404   
                    && httpEx.Source.StartsWith("Telerik.Cms")  
                    && httpEx.Message.StartsWith("Invalid Page language version request!"))  
                {  
                    // Get requested page  
                    //Telerik.Cms.ICmsPage page = httpEx.Page;  
                      
                    Response.Redirect("~/Sitefinity/NoLanguageVersion.aspx.aspx");  
                    Response.End();  
                }  
            }  
        } 

    As for the Language bar and the postback issue, at the Pages tab in edit page mode, when you drag the Language Selector control onto the page, you can expand section Behavior and set the PostBack property to False. To do the same for the administrative backend, modify the ~/Sitefinity/Admin/Admin.master as follows:

    <sf3:LanguageBar ID="LangBar" runat="server" PostBack="false">  

    Let us know if you need any further assistance.

    All the best,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
4 posts, 0 answered