Different master pages for content on seperate servers?

Last post 07-09-2008 1:17 PM by ShailAtlas. 5 replies.

Sort Posts:

  • Different master pages for content on seperate servers?

    07-08-2008, 2:33 PM
    • Member
      point Member
    • PatDukes
    • Member since 07-08-2008, 5:27 PM
    • Rock Hill, SC
    • Posts 4

    Our organization has a public website and an internal website.  Both sites have their own master page and content pagse.  The intranet site contains all of the content pages from the online site, plus some extra pages. Currently there are two copies of every file, one on the internet server, one on the intranet server (ie, Default.aspx exists both in x:/internet/ and x:/intranet) . These pages are completely identical, except for the master page, which contains different styling for the respective sites.  As it stands now, to update one page, it needs to be changed on both servers.  Is there a way to host the content pages on the internet server and then just pull them from there for the intranet server?  If you're sitting on our network you can see both servers, from the outside you can only see the web server.

     My idea is to keep two master pages and assign it to all pages based on what server the user is on, using the  <pages master= "" > tag in the web.config file.  Each server would have a different web.config.

     

    Does anyone have experience with this, or suggestions on accomplishing this?

     

    Here's a table showing what I want, this is just an example; the real site has about 15 pages online and another 10 that are only viewable on the intranet

    Current Setup:
    Internet Files Intranet Files
    default.aspx default.aspx
    about.aspx about.aspx
    links.aspx links.aspx
    users.aspx
    applications.aspx
    web.config web.config
    online.master intra.master
           
    Ideal Setup:
    Internet Files Intranet Files
    default.aspx
    about.aspx
    links.aspx
    users.aspx
    applications.aspx
    web.config web.config
    online.master intra.master

     

    Green text represents files that can ONLY be seen on the Intranet side

    Filed under: , ,
  • Re: Different master pages for content on seperate servers?

    07-09-2008, 10:22 AM
    Answer
    • Contributor
      2,247 point Contributor
    • ShailAtlas
    • Member since 07-18-2006, 1:07 PM
    • Norway
    • Posts 546

    Hi,

    Lets us try this. You have IIS 6.0. set two web sites there lets say "www.internet.xyz.com" and "www.intranet.xyz.com". But the home directory of both the web sites will be folder "X"

    Site Name                                    Home Directory

    ------------------------------------------------------------------------------------

    http://www.intranet.xyz.com                C:\X

    http://www.internet.xyz.com                C:\X

     

    Now you have two IIS web sites, but actually they point to same files on the file system. Now next step in your Global.aspx on begin request event check for URL, if it is valid and has internet or intranet as starting word. Once you know from what it is starting you can add a variable in context say Context["MasterPage"]. Once you have decided what will be master page. you can set the name of master in the load event of the page. Try it May be it can work.  And off course both masters will have different sitemaps.

    So the main thing which will make a difference will be name of Host in the URL ( Request.URL.Host or something same ). Actually you have same file base, but they are two web sites on IIS. Also they will be altogether different applications so both have there own processing and life cycles. Remember files will be shared, even the web.config file also

    Thanks

    -- Shail

  • Re: Different master pages for content on seperate servers?

    07-09-2008, 10:38 AM
    • Member
      point Member
    • PatDukes
    • Member since 07-08-2008, 5:27 PM
    • Rock Hill, SC
    • Posts 4

     That looks like it would work but I am forced to have the websites on two different servers.  Our organization mandates that any Intranet site is on the server named Intranet and any Internet site (viewable by the public) is on a server named Internet. I can't make two seperate sites on the Internet side.

  • Re: Different master pages for content on seperate servers?

    07-09-2008, 10:54 AM
    • Contributor
      2,247 point Contributor
    • ShailAtlas
    • Member since 07-18-2006, 1:07 PM
    • Norway
    • Posts 546

    Better write a script which copies the files from internet server to intranet server. Copy only the meaning full file like aspx or master page file. Exclude web.config from that. Then set the name of master in web.config of each server.Check how to make a WMI or any other script, which execues when something is changed in a directory and the change you are looking for.

    Something like file synhcronisation script. Huh...

  • Re: Different master pages for content on seperate servers?

    07-09-2008, 12:53 PM
    • Member
      point Member
    • PatDukes
    • Member since 07-08-2008, 5:27 PM
    • Rock Hill, SC
    • Posts 4

     The ultimate goal is to only have one copy of each file, so that there doesnt need to be a file on both servers.

    Unless I misunderstand, a file sync script will keep the files the same, but still require a copy of the file on both servers, correct?

  • Re: Different master pages for content on seperate servers?

    07-09-2008, 1:17 PM
    • Contributor
      2,247 point Contributor
    • ShailAtlas
    • Member since 07-18-2006, 1:07 PM
    • Norway
    • Posts 546

    Yes the script will copy from one place to another.

    OK Try to map drive on intranet server from internet server. Lets say you have a new mapped drive named Z:. Actually it is pointing to your directory or drive on Internet server. Then use the Z: drive or whatever folder there to set up a web site on Intranet server's IIS. You need to do this because you can not use a network folder acting as home directory for any IIS web site

     

Page 1 of 1 (6 items)