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.
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.
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 ;)
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:
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
umbraco.library - this library contains a lot of useful methods also when building masterpages and usercontrols.
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.
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 :-)
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?
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.
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.
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!
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
Umbraco has 2 configuration properties which you can use to solve this problem:
When excluding a folder all pages and sub folders at automatically excluded. In fact, that's how the /umbraco folder works ;)
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.
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 :-)
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:
Jesper Hauge
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 :-)
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
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?
So far I have had luck using UmbracoContext.Current.PageId which will be null if you are on a custom page.
Hi,
I am using the
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:
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
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.
is working on a reply...