Copied to clipboard

Flag this post as spam?

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


  • Mario Lopez 168 posts 957 karma points MVP 4x c-trib
    Mar 23, 2016 @ 03:32
    Mario Lopez
    0

    Unable to use Controller Authorisation

    I am trying to use an UmbracoAuthorizedController on the backend and for some reason is giving me the following error:

    The process cannot access the file 'C:\BitBucket\CEAV\CEAV-Web\CEAV\App_Data\TEMP\ExamineIndexes\ASTA-8PBQG62\InternalMember\Index\write.lock' because it is being used by another process.

    If I try with the UmbracoAuthorize attribute I get the same error but if I try with UmbracoController all works well.

    Any idea why I can't use the Authorized Controller?

    Thank you.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Mar 23, 2016 @ 07:52
    Dave Woestenborghs
    0

    Hi Mario,

    Can you post some code ? It's easier to reproduce when people can see the code.

    Dave

  • Mario Lopez 168 posts 957 karma points MVP 4x c-trib
    Mar 23, 2016 @ 21:58
    Mario Lopez
    0

    Thanks for the suggestion Dave, it's just that the code seems pretty straight forward, but here we go:

    I have my controller in the App_Plugins but it is not using the plugin attribute or anything.

    My Controller:

    namespace CEAV.App_Plugins.EventsAttendance
    {
        public class PrintableListController : UmbracoController
        {
            private readonly CPDEventsRepo _repo;
    
            public PrintableListController()
            {
                _repo = new CPDEventsRepo();
            }
    
            public ActionResult Index(int id)
            {
                EventSold ev = GetEvent(id);
    
                return View("~/App_Plugins/EventsAttendance/views/PrintableList.cshtml", ev);
            }
    }
    }
    

    My route:

    protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
        {
    
            RouteTable.Routes.MapRoute(
                name: "PrintableLists",
                url: "backoffice/PrintableList/{id}",
                defaults: new { controller = "PrintableList", action = "Index", id = UrlParameter.Optional }
            );
        }
    

    I can access the controller using:

    http://dev.domain.local/backoffice/PrintableList/299

    This is actually working. The problem comes if I use the UmbracoAuthorizedController.

  • Travis Wilson 4 posts 93 karma points
    Jul 08, 2016 @ 17:32
    Travis Wilson
    0

    I'm having the same issue.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Mar 24, 2016 @ 07:15
    Dave Woestenborghs
    0

    Hi Mario,

    I think that the problem is that you are registering your own routes.

    Umbraco handles the routing out of the box : https://our.umbraco.org/documentation/Reference/Routing/WebApi/routing

    https://our.umbraco.org/documentation/Reference/Routing/Authorized/

    If you inherit from UmbracoAuthorizedApiController the route created by Umbraco also starts with /backoffice...Probably your route conflicts with this

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft