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

Forums / Developing with Sitefinity / Domain and Sub-Domain management

Domain and Sub-Domain management

12 posts, 0 answered
  1. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    30 Mar 2009
    Link to this post
    Hi,

    I am currently evaluating Sitefinity as a possible CMS for use with the re-write of our website.

    In the website, we have many subdomains which use different master templates but have the same content as the main domain. How would we achieve this with Sitefinity?

    Thanks and Regards,

    Kristina Thong
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    30 Mar 2009
    Link to this post
    Hi Kristina,

    A possible solution is creating a code that checks your url. Depending on the URL - a theme and master page is set dynamically.

    Here is an example

    using System; 
    using System.Web; 
    using Telerik.Cms.Web; 
     
    /// <summary> 
    /// Summary description for ChangePage 
    /// </summary> 
    ///  
    namespace Telerik.Samples 
        public class ChangePage : InternalPage 
        { 
            public ChangePage() 
            { 
            } 
     
            protected override void OnPreInit(EventArgs e) 
            { 
                base.OnPreInit(e); 
     
                HttpContext context = HttpContext.Current; 
                if ((context.Request.RawUrl.Contains("domain.com"))) 
                { 
                    if (base.CmsPage.Template != null
                    { 
                        base.OnPreInit(e); 
                        Page.Theme = "Orange with left sidebar"
                        Page.MasterPageFile = "~/App_Master/Default.master"
                    } 
                } 
            } 
        } 

    We also nedd to change ~/Sitefinity/cmentrypoint.aspx

    <%@ Page Inherits="Telerik.Samples.ChangePage" MasterPageFile="~/Sitefinity/Dummy.master" %> 


    Greetings,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    31 Mar 2009
    Link to this post
    Hi,

    Thanks for your response.

    Just to clarify on your response:
    1. What is the file ~/Sitefinity/cmentrypoint.aspx and why do we need to make a change in this file? Is there any documentation that I can read up about this?
    2. Where would I implement the code to dynamically change the template? On the Sitefinity page or my ASP.NET page?

    Thanks for your help.

    Regards,

    Kristina Thong
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    31 Mar 2009
    Link to this post
    Hello Kristina,


    1. What is the file ~/Sitefinity/cmentrypoint.aspx and why do we need to make a change in this file? Is there any documentation that I can read up about this?

    All page requests pass through cmsentrypoint.aspx. The file inherits InternalPage.cs which implements methods for page management- getting  the mode of the page, name of the Cms Page, instance of CmsManager, optional page settings like EnableViewState, returns the name of the Theme to be set for the current page  We do not have documentation about this file.

    2. Where would I implement the code to dynamically change the template? On the Sitefinity page or my ASP.NET page?
    You should create a class in your App_Code folder and make the changes in cmsentrypoint.aspx as in the example.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    08 Apr 2009
    Link to this post
    Hi there,

    Reading the posts above, I can understand that you can change the outlook of the CMS depending on the domain! Which is cool.

    But my situation is different. I'd like to change the theme of the working site (not Sitefinity CMS) depending on the domain. I guess that's not hard to do. Can I change the Theme of a Master that I have uploaded in SF, trough code-behind?
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Apr 2009
    Link to this post
    Hi Angel,

    The better way is using the handler because you can set Theme propertyin or before the 'Page_PreInit' event. Here is description on Events in ASP.NET Master and Content Pages

    All the best,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  7. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    09 Apr 2009
    Link to this post
    Hi Ivan,

    Can you elaborate on your comment please?
    "The better way is using the handler because you can set Theme propertyin or before the 'Page_PreInit' event. Here is description on Events in ASP.NET Master and Content Pages"

    Thanks and Regards,

    Kristina Thong

  8. Kristina
    Kristina avatar
    17 posts
    Registered:
    17 Mar 2009
    09 Apr 2009
    Link to this post
    Hi Ivan,

    Can you elaborate on your comment please?
    "The better way is using the handler because you can set Theme propertyin or before the 'Page_PreInit' event. Here is description on Events in ASP.NET Master and Content Pages"

    Thanks and Regards,

    Kristina Thong

  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    09 Apr 2009
    Link to this post
    Hello Kristina,

    Please take a look at the MSDN link. Master pages does not have PreInit event.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  10. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    09 Apr 2009
    Link to this post
    Hi again,

    what if I want to change the Theme on a page depending on a query parameter. How can I do that?

    I can't do it in the master page that I upload, because there is no PreInit!
    I can't do it in a page, because I'm creating the page in Sitefinity!
    And I can't do it in a control, because there is no PreInit as well!

    Thanks,

    Angel
  11. Angel
    Angel avatar
    32 posts
    Registered:
    04 Feb 2008
    09 Apr 2009
    Link to this post
    PS: I managed to do it with adding external page, but I don't think that's a good solution. I wouldn't use cms, if I'm using external pages, right ;)
  12. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    09 Apr 2009
    Link to this post
    Hi Angel,

    I believe that the following thread will be helpful - http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-babchd.aspx
    It is showing you how to change the themes dynamically.

    All the best,
    Georgi
    the Telerik team

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