Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adam Jenkin 71 posts 226 karma points
    Jan 24, 2011 @ 13:46
    Adam Jenkin
    0

    Using Umbraco MasterPages on non Umbraco page

    Hi All, 

    I am currently looking at a project which involves migrating an existing website into Umbraco. I’m quite conformable with the content migration side of the project; however a large part of the existing website is a complex member portal which I would like to export as is and “wrap” with Umbraco. 

    I’m quite new to Umbraco, I’ve had a look over the community for similar questions so please forgive me if this has been covered before!

    This is what I would like to do:

    1. From the existing website, copy the components for the MemberPortal into a sub folder of the Umbraco site “MemberPortal”.
    2. Tell Umbraco to not handle requests past ~/MemberPortal.
    3. Change the MemberPortal pages to use the Umbraco website mater pages to inherit the look and feel of the cms site.

    Item 3 is my biggest concern. As the MasterPages will be using Umbraco controls, will they still continue to work (or fail gracefully) when they are loaded outside of an umbraco context? 

    I know items which require a reference to the current Umbraco page are not going to work, however will I still be able to generate navigation elements (From CMS content) and such like in these templates?

    Potentially, I might consider setting up the MemberProfile folder as a virtual directory so I can keep the Umbraco site a little cleaner (although I recall seeing somewhere that Umbraco and VD’s don’t mix well?)

    I’d appreciate any advice on this topic and/or any pointers or warnings about other areas of the integration I may not have considered.

    Many Thanks,

    Adam

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Jan 24, 2011 @ 14:14
    Michael Latouche
    0

    Hi Adam,

    I have never done this, but my guess for Item3 is that it will indeed "fail gracefully": the umbraco elements are just tags that will be ignored as "unknown tag" when outside the Umbraco context. The only issue you might have is if you explicitely access thoses Umbraco elements from your MasterPage codebehind page, because then those objects will be unknown.

    As for creating navigation elements etc. from CMS content into those pages, it should normally be possible as long as you have references to the umbraco libraries, although maybe a little more complex to implement (it depends on what you want to do).

    Hope this gave you some indications :-)

    Cheers,

    Michael.

  • Adam Jenkin 71 posts 226 karma points
    Jan 24, 2011 @ 14:37
    Adam Jenkin
    0

    Thanks mike,

    I have just tried a simple test.

    I have a blank 4.6.1 website from which I have installed the standard starter kit and applied the business theme.

    I have added a test.aspx to the root which simple contains:

    <%@ Page Language="C#" MasterPageFile="~/masterpages/umbBusiness.master" %>  

    Then in the web.config I have added to the umbracoReservedUrls setting test.aspx.

    When I request the page, I get the famous "Object not set to an instance of an object" error.

    [NullReferenceException: Object reference not set to an instance of an object.]
       umbraco.item..ctor(IDictionary elements, IDictionary attributes) +219
       umbraco.presentation.templateControls.ItemRenderer.GetFieldContents(Item item) +477
       umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item item) +70
       umbraco.presentation.templateControls.Item.OnInit(EventArgs e) +328
       System.Web.UI.Control.InitRecursive(Control namingContainer) +132
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Control.InitRecursive(Control namingContainer) +420
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1953


    I know the template is using macros referring to current page, however I was hoping this would have failed a little more gracefully :/

  • Michael Latouche 504 posts 819 karma points MVP 3x c-trib
    Jan 24, 2011 @ 15:49
    Michael Latouche
    0

    Hi Adam,

    Can you put an extracte of your web.config part for umbracoReservedUrl? Dis you put "test.aspx" or "~/test.aspx"?

    Cheers,

    Michael.

  • Adam Jenkin 71 posts 226 karma points
    Jan 24, 2011 @ 15:51
    Adam Jenkin
    0

    I've used ~/test.aspx

    <add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/test.aspx" />
  • Adam Jenkin 71 posts 226 karma points
    Jan 24, 2011 @ 17:09
    Adam Jenkin
    0

    A quick update, I have created a simple template for use by the static file in Umbraco:

    <%@ Master Language="C#" AutoEventWireup="true" %>
    <html>
      <head runat="server">
      </head>
      <body>
        <div id="topInner">
          <h1 id="siteName"><a href="/" id="siteNameLink"><umbraco:item id="Item3" runat="server" field="siteName"></umbraco:item></a></h1>
          <h2 id="siteDescription"><umbraco:item id="Item4" runat="server" field="siteDescription"></umbraco:item></h2>
        </div>
        <form id="form1" runat="server">
        </form>
      </body>
    </html>

    It uses items from the Umraco website context, however I believe there should be no dependancy on the current page with these items.

    Unfortunailty, I am still recieving the same error as above.

  • Jeff Chapin 18 posts 39 karma points
    Mar 16, 2011 @ 02:11
    Jeff Chapin
    0

    Adam - 

    Were you ever able to get regular aspx page to work with an umbraco masterpage?

    I want to do the same thing... Have umbraco handle the navigation for all my legacy aspx pages.

  • Adam Jenkin 71 posts 226 karma points
    Mar 16, 2011 @ 11:59
    Adam Jenkin
    0

    Hi Jeff, 

    I did but only from a POC/playing around.

    Essentially the problem is that within a XSLT macro, when there is no umbraco context (i.e on a static page) there are no xml bindings to the document or the current page variable.

    To get around this, I was able to call the XSLT extension method "umbraco.library.GetXMLAll()" and read in the site content into a variable which I then passed to the xslt templates for processing.

    Im not sure I particullary like the approach - it works, but need to look into it further before Id be happy to scale it up to a real site.

    Be great to hear how you get on if you persue this!

     

     

     

  • Jeff Chapin 18 posts 39 karma points
    Mar 16, 2011 @ 18:32
    Jeff Chapin
    0

    Can I take a look at that code?  If I can see it, it may open my eyes to other possibilities.  my e-mail is [email protected]
    I was going to take the day today an write an ASCX that can read an ASPX page and pass the HTML into Umbraco.  Unfortunatly I know doing it this way will fall apart if the page has any post-back controls.  Else I was thinking of opening the Unbraco source to find out why it can't be a shell for fixed aspx pages. 

Please Sign in or register to post replies

Write your reply to:

Draft