Copied to clipboard

Flag this post as spam?

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


  • Thomas 157 posts 332 karma points
    May 15, 2015 @ 15:56
    Thomas
    0

    UmbracoAuthorizedController - Http Error 401.0

    Hi,

    I am very disappointed and i need desperately your help. I am one step before going live and now the site is not working. To be more specific. I had create a custom section, trees and UmbracoAuthorized controllers. I am not using Angular, i am using Razor. Just before 7.2.2 everything was working fine. In backoffice when i was clicking an item in my custom tree items i was getting the edit page correctly throught the routing map.

    routes.MapRoute(
                   name: "TravelScanDefault",
                   url: "App_Plugins/TravelScan/{controller}/{action}/{id}",
                   defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
               );

    All the files are under the App_Plugins/TravelScan/ folder.

    And the controller is:

    [PluginController("tsCities")]
    public class tsCitiesController : UmbracoAuthorizedController
    {
            public ActionResult Index(int id)
            {
                tsCity item = null;
                tsCityViewModel model = null;

                //Get the current Umbraco Node ID
                var currentNodeId = UmbracoContext.PageId.HasValue ? UmbracoContext.PageId.Value : id;

                var apiCntrl = new tsCitiesApiController();
                item = apiCntrl.GetById(id);

                model = new tsCityViewModel() { City = new tsCity(), GeoLocation = new PlaceViewModel() };

                if (null != item)
                {
                    model.City = item;
                    if (!string.IsNullOrEmpty(item.Latitude) && !string.IsNullOrEmpty(item.Longitude))
                    {
                        model.GeoLocation = new PlaceViewModel()
                        {
                            Pos = new GeoCoords()
                            {
                                Latitude = item.Latitude,
                                Longitude = item.Longitude,
                                Zoom = item.Zoom
                            }
                        };
                    }
                }

                PopulateDDL(model);

                // Create ViewBag Dynamic Properties for the Localized Detailed Descriptions
                foreach (var cultureName in model.Cultures)
                {
                    ViewData.Add("DetailDesc_ResourceValue_" + cultureName, model.City.LocalizedDetailedDescription(cultureName));
                }

                return View("~/App_Plugins/TravelScan/BackOffice/Views/tsCities/Index.cshtml", model);
            }

    }

     

    After the upgrade to 7.2.4 i was testing the site in order to go live, i realize that all the backoffice custom razor edit pages are not working and i am getting the following error:

     

    HTTP Error 401.0 - You must login to view this resource.

    You do not have permission to view this directory or page.

     

    I appreciate any suggestions or your help. I am desperate... i don't know how to fix it and the customer is waiting for the GoLive...

    Regards

    Thomas

  • Alex 4 posts 85 karma points
    Aug 24, 2017 @ 05:16
    Alex
    0

    Sorry for the late bump, but I am running into the same issue and am wondering if anyone solved it? I can't find any documentation that outlines this stuff clearly anywhere.

  • Alex 4 posts 85 karma points
    Aug 24, 2017 @ 05:40
    Alex
    1

    Nevermind, just figured it out after tons and tons of trial and error.

    Your route needs to be something like:

    "umbraco/backoffice/Plugins/PluginFolder/Controllers/{action}"
    

    PluginFolder is in App_Plugins.

    Then in your tree you need to do something like:

    contentNode.Action = "javascript:openPage('/umbraco/backoffice/Plugins/PluginFolder/Controllers/Index');";
    

    Your plugin folder looks like this:

    PluginFolder

    • Controllers
      • PluginFolderContoller

    It just needs to be routed through "umbraco/backoffice/Plugins/" but that points to the App_Plugins folder, which should be documented somewhere if someone with the power to do that sees this. :)

  • Lesley 107 posts 349 karma points
    Aug 09, 2018 @ 04:19
    Lesley
    0

    Thanks Alex!

    Just done an upgrade from Umbraco v6 to v7 and couldn't get our custom plugin to load.

    Your solution fixed it for me :-)

Please Sign in or register to post replies

Write your reply to:

Draft