Copied to clipboard

Flag this post as spam?

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


  • pdotnet 3 posts 24 karma points
    Mar 04, 2010 @ 22:30
    pdotnet
    1

    Extending a web site outside of Umbraco. Best practices?

    I have just successfully deployed my first Umbraco based website and now am wondering where to look to start extending the site into a web application?  I have a lot of requirements that are going to demand custom .NET code and an enormous database that won't be suited to using Umbraco to manage. 

    Using user controls as macros has worked well for me so far, but mostly for specific widget-style tasks.  What I ultimately want to do is start building new pages using Visual Studio that are based on my Template master pages in Umbraco, but do not exist as Content nodes.  Using the Umbraco master pages would be ideal because the layout would carry through, the XSLT dynamic menu would carry through, etc... (although I don't expect my non-node pages to appear in the menu obviously)

    What I've done as a test is created an aspx page called "Test.aspx" which uses a Template master page and dropped it in the root folder.  However when I browse I get the error "No umbraco document matches the url" presumably because the URL rewriting is ignoring physical files and is only looking at the Umbraco database for the content.  Is the easy answer to create blank content nodes under a different folder and just hide them from the users?

    What's my next step towards doing this?  Does this approach even make sense?  Has anyone used Umbraco for a Web Application but only needed it to manage content in certain areas?  Hopefully I've explained this well enough.  I guess in short: I want to build asp.net pages around an Umbraco website. 

    Thanks in advance for any advice or suggestions!

     

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 04, 2010 @ 22:38
    Peter Dijksterhuis
    0

    Hi,

    you can easily tell umbraco to stop parsing certain url's. Open the web.config file. There are 2 keys there: umbracoReservedUrls and umbracoReservedPaths.

    As the names says, you can exclude a single file (like test.aspx) or a complete directory (like /umbraco/). To make your test.aspx page work, simply add it to the ReservedUrls.

    If you plan on creating a lot of pages, you might want to think about creating a folder for those. Add that folder to the ReservedPaths, and add your files in that folder. Umbraco will not try to process those files then and you should be good to go.

    HTH,

    Peter

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Mar 04, 2010 @ 22:40
    Aaron Powell
    0

    Umbraco has 2 configuration properties which you can use to solve this problem:

    • umbracoReservedUrls
    • umbracoReservedPaths
    You can either specify a single file (eg: /Test.aspx) to be ignored by Umbraco, or an entire folder structure (eg: /MyApp).
    When excluding a folder all pages and sub folders at automatically excluded. In fact, that's how the /umbraco folder works ;)

  • pdotnet 3 posts 24 karma points
    Mar 04, 2010 @ 23:00
    pdotnet
    0

    Thanks both of you for such a quick response, I think this is exactly what I'm looking for.  I'll experiment with it tomorrow and let you know.

     

  • jaygreasley 416 posts 403 karma points
    Mar 04, 2010 @ 23:11
    jaygreasley
    0

    I have done exactly this with an asp.net app, works fine. What I haven't done is use the Umbraco Master page and libraries, but I want to now :-)

  • Jesper Hauge 298 posts 487 karma points c-trib
    Mar 04, 2010 @ 23:35
    Jesper Hauge
    1

    I think I'd go with the folder and the reserved paths/urls if the part "other" part of your application has nothing in common with your application.

    But I'll recommend using Umbraco to manage all aspects of your sites structure, and incorporate dataviews and forms through usercontrols and masterpages, and maybe even xslt-extensions. I think this will result in a site that is more manageable than two different "applications" in one site. Here's some pointers to things I found to be useful in this respect:

    1. Masterpages and usercontrols - If you set up a Visual Studio web application project, copy the umbraco folder to the root and reference the umbraco dll's you'll be able to code and build masterpages and usercontrols that uses different parts of the umbraco api
    2. umbraco.library - this library contains a lot of useful methods also when building masterpages and usercontrols.
    3. umbraco.presentation.nodeFactory.Node - the best way to get data out of the umbraco store in usercontrols and masterpages.
    4. The XsltResult package - this will enable inserting umbraco xslt-renderings in your usercontrols and masterpages without macros. Xslt renderings is often the fastest way to display data from the umbraco store, especially when creating lists.
    Hope this helps
    Regards
    Jesper Hauge

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Mar 05, 2010 @ 00:24
    Morten Bock
    1

    Just a quick note on this.

    When putting your .aspx pages i a separate folder and not letting umbraco handle them, might be a problem in terms of reusing your masterpages if you have umbraco specific macros on them. For example you navigation xslt would probably not work if you are relying on the $currentPage parameter, which of course does not exist, since there is not umbraco context.

    You can still access the umbraco nodes with the nodefactory, but allt the .GetCurrent() stuff will blow up :-)

  • Murray Roke 503 posts 966 karma points c-trib
    Mar 10, 2010 @ 00:08
    Murray Roke
    0

    Hi All

    I have the same problem of trying to share a master page with umbraco and something outside the umbraco context. However my 'other' folder is an MVC application so Jesper's solution won't fit for me.

    So I'm going with morten's idea, and so far so good, but I would like to use GetCurrent() when I DO have an umbraco context, but I'm not sure how to test for it?

    I can't just say

    if (Node.GetCurrent() != null)

    Because that causes a null reference exception. (should I classify as a bug on codeplex?) anyway, is there a better way to test if I have the umbraco context available?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Mar 14, 2010 @ 08:24
    Morten Bock
    0

    So far I have had luck using UmbracoContext.Current.PageId which will be null if you are on a custom page.

  • Garrett Fisher 341 posts 496 karma points
    Sep 20, 2010 @ 22:40
    Garrett Fisher
    0

    Hi,

    I am using the

    • umbracoReservedUrls
    • umbracoReservedPaths

    technique to try and access some plain vanilla ASP pages that I don';t need to manage in Umbraco, and I am still getting 404 errors when requesting them. 

    web.config code:

    <add key="umbracoReservedUrls" value="/config/splashes/booting.aspx,/install/default.aspx,/config/splashes/noNodes.aspx,/legacy/register.asp,/legacy/thank-you-installer.asp" />
    <add key="umbracoReservedPaths" value="/umbraco,/install/,/legacy/" />

    These two files in the /legacy/ directory definitely exist, and I can also request a static of almost any other file extension.  It keeps giving me 404 errors for ASP pages.  Why?  How to fix?  Is this an IIS config thing?  I have IIS 6.1.

    Thanks,

    Garrett

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Sep 20, 2010 @ 23:34
    Morten Bock
    0

    It does sound like an IIS thing, since you are able to get it working with other extensions. 

    In general it should not be needed to add the file url's to the umbracoReservedUrls, when the path is already in the umbracoReservedPaths.

Please Sign in or register to post replies

Write your reply to:

Draft