Custom plugin - Route works only when logged in as an admin.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 anos atrás
My plugin puts a navigation item in the public store Customer "My Account" page.
Here's the route I add in my plugin

            routes.MapRoute("Plugin.CustomerAccount.PublicCustomerAccountList",
                 "Customer/Accounts",
                 new { controller = "PublicCustomerAccounts", action = "List" },
                 new[] { "Nop.Plugin.CustomerAccount.Controllers" }
            );


It works fine when I'm logged in as admin.  But otherwise, it directs me to the login page (with a ReturnUrl):  

/login?ReturnUrl=%2fcustomer%2fAccounts

I still remain logged in.

When I put a breakpoint in the Login() method (in the core CustomerController), the stack trace shows only that it's coming from "External code".  Expanding that, I see only calls from System.Web.Mvc  (the last one coming from method

     System.Web.Mvc.dll!System.Web.Mvc.ActionMethodDispatcher.Execute(...

So, I have no idea where this redirect is coming from.  Thoughts?

(Might this be some anomaly in that I'm using one of the 'built-in' route urls  - i.e.  Customer/...) ?
7 anos atrás
New York wrote:
It works fine when I'm logged in as admin.  But otherwise, it directs me to the login page (with a ReturnUrl)

Is is possible that you've accidentally put an [AdminAuthorize] attribute on one of the downstream Controller classes or ActionResults?
7 anos atrás
That was it.  (copy/paste anti-pattern ;)

Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.