Copied to clipboard

Flag this post as spam?

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

  • Ben Haynie 20 posts 50 karma points
    Nov 28, 2013 @ 20:53
    Ben Haynie

    Can you use .NET MVC in Umbraco 7 Backoffice

    Can you use .NET MVC in Umbraco 7's Back Office? I believe this was a possibility in earlier versions of Umbraco, but based on what I have seen, it appears that you need to use normal HTML and AngularJS.
    Is there a way to use .NET MVC? I don't see any way to tell the back office what URL to use for a Tree item.

  • Comment author was deleted

    Nov 28, 2013 @ 21:21

    Yes you can still use .net MVC

    check for details

    part of the optimus package us using that approach

  • Comment author was deleted

    Nov 28, 2013 @ 21:22

    So with v7 you have at least 3 options, use angularjs and web api, do it the .net mvc way or still use webforms

  • Ben Haynie 20 posts 50 karma points
    Nov 28, 2013 @ 23:43
    Ben Haynie

    Thank you Tim. I enjoyed your post, and found it very useful. However, in my instance (with Umbraco 7), I was unable to get it to work. The code I have for the Tree is this:

    [Umbraco.Web.Trees.Tree("GovAP", "SecurityTree", "Windows Authentication")]
    public class SecurityTree : BaseTree
        #region Constructor
            public SecurityTree(string application)
                : base(application)
        #region Public Methods
            protected override void CreateRootNode(ref XmlTreeNode rootNode)
                rootNode.NodeType = "example";
                rootNode.NodeID = "init";
                rootNode.Menu = new List<umbraco.interfaces.IAction> { ActionRefresh.Instance };
            public override void Render(ref XmlTree tree)
                var node = XmlTreeNode.Create(this);
                node.NodeID = "1";
                node.NodeType = "person";
                node.Text = "My Test";
                node.Action = string.Format("javascript:sayHello({0});", "1");
                node.Icon = "../../../App_Plugins/GovAP/Security/Icons/security-icon.png";
                node.OpenIcon = "../../../App_Plugins/GovAP/Security/Icons/security-icon.png";
                node.HasChildren = false;
                node.Menu = new List<umbraco.interfaces.IAction>();
                OnBeforeNodeRender(ref tree, ref node, EventArgs.Empty);
                if (node != null)
                    OnAfterNodeRender(ref tree, ref node, EventArgs.Empty);
            public override void RenderJS(ref StringBuilder Javascript)
                                    function sayHello(id) {
                                        alert('Hello ' + id);

    As you note, I don't have any MVC being used yet, I am just hard coding one menu item, to see if it will show up in the back office. I understand how you are doing the rest of it, and can get that coded up, if I can get this to render properly. After copying the DLL's to the Bin folder, and the other code to the App_Plugins folder, I run and see the following in the Back Office. enter image description here As you can see, the Application is there, but there is nothing in the Tree.

    I had thought that it might be due to some of the breaking changes listed on Umbraco 7's release site.

    There are several breaking changes, consult the Umbraco 7 upgrade documentation for further infomation

    Old property editors do not work anymore
    Old macro parameter editors do not work anymore
    Legacy API events have been disabled
    Legacy tree events have been disabled
    All configuration files have changed and must be migrated
    All code marked as obsolete since Version 4 has been removed
    There is no ImageCropper Property editor
    The Related Links property editor uses a new data format for xslt

    So I went to the advice followed on this Blog Post ( and it seems to use AngularJS.

    I have tried this code as well, but I don't see a way to use MVC with it, as there is no way to specify the URL. Any ideas?

  • Comment author was deleted

    Nov 29, 2013 @ 08:50

    Check the code for optimus :)

    Maybe first try getting a tree in an existing section then move it to custom one

  • Comment author was deleted

    Nov 29, 2013 @ 08:53

    And for a angularjs example check out

  • Ben Haynie 20 posts 50 karma points
    Nov 29, 2013 @ 17:40
    Ben Haynie

    Tim, thank you very much.  You have pointed me in the right direction.  It seems that there are several Tree attributes, and I was referencing the wrong one.  I will go back through my code and see if I can figure out where I went wrong.  I took your code from Git Hub, and was able to replicate, so it seems that I should be able to get this to work.  It would also seem that some of these settings are stored in Config files some where, because when I make a small change to the code (such as changing the title), it doesn't take effect the next time I run it.  I would imagine it is storing it somewhere, and will track that down.  Thank you again for pointing me in the right direction!


  • John French 32 posts 83 karma points
    Apr 09, 2015 @ 06:17
    John French



    Did you get this to work?  I also cannot get the trees to work using the MVC apporach.  Works in umbraco 6 but not umbraco 7 e.g

    building my tree for my custom section with this method

     [Tree("customers", "customersTree", "Customers")]

        public class Customers: BaseTree

    dosen't work in umbraco 7 -

     if I want to get the trees to render I have to use

     [Tree("customers", "customersTree", "Customers")]
        public class CustomerTreeController : TreeController


    but then thats forcing me to use AngularJS for my backoffice pages but I already have them done in MVC (as this is an umbraco 6 project been ported to umbraco 7)

    any success with this anyone?

  • Comment author was deleted

    Apr 09, 2015 @ 10:17
  • John French 32 posts 83 karma points
    Apr 10, 2015 @ 02:54
    John French

    Hi @Tim - thanks for the reply - I had previously tried this code but couldn't get it to work but actually figured out why now - for some reason it wasn't updating the tree.config after I had rebuilt and restarted IIS - not sure why as permissions all look okay but after I manually make the change it all works now - just in case anyone else comes across this problem then check that the tree.config is updating with your custom tree..!



  • nickornotto 377 posts 869 karma points
    May 23, 2017 @ 14:19

    Tim, I have created a new section and successfully listed all menu items (persons) in my Umbracp 7 based on your UmbracoMVCBackofficePages example.

    However when I click any of the menu items I'm getting 401 (You must login to view this resource) page. No matter the view is within


    (within my separate project)



    (within the main site)

    Why is this happening?

  • Comment author was deleted

    May 23, 2017 @ 16:10

    Hmm it's been a while since I build this so not sure how this behaves in latest Umbraco versions

  • nickornotto 377 posts 869 karma points
    May 24, 2017 @ 14:11
Please Sign in or register to post replies

Write your reply to: