Try our conversational search powered by Generative AI!

ClassicLinkRoute with VirtualRole

Vote:
 

I have a custom virtual role setup to allow read access to content items based on a token in the URL. This was working fine until the 7.5 update to the routing since I was using the 'ClassicLinkRoute'.

On this document: http://world.episerver.com/Blogs/Johan-Bjornfot/Dates1/2013/12/Routing-changes-in-75/
we can add the classic route back in using: 

protected override void RegisterRoutes(System.Web.Routing.RouteCollection routes)
        {
            base.RegisterRoutes(routes);
            routes.Insert(0, ServiceLocator.Current.GetInstance());
        }

but this breaks the CMS routing. I only want the route to run if the querystring is present, so I created a class inheriting from ClassicLinkRoute and over rode the GetRouteData to check for the querystring value and registered my custom route. The override is:

        public override RouteData GetRouteData(HttpContextBase httpContext)
        {
            if (!string.IsNullOrEmpty(httpContext.Request.QueryString["token"]))
            {
                
                return base.GetRouteData(httpContext);
            }

            return null;
        }

but this prevents my virtualrole from being picked up.

How can I get this ClassicLinkRoute to work with my custom VirtualRoleProvider?

#88145
Jul 03, 2014 4:15
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.