I have created an MVC area in the solution:

|_ CAG  
  |_ Controllers  
  |_ Models  
  |_ Views  

When published, the Areas folder goes into the root of the instance's webroot.

Here is the Area registration:

public class CAGAreaRegistration : AreaRegistration 
        public override string AreaName 
                return "CAG";

        public override void RegisterArea(AreaRegistrationContext context)
            //to load default page when the url is '<instance>/ContentAuthoringGuide
                new { controller = "CAG", action = "Index", id = UrlParameter.Optional }

                new { action = "Index", id = UrlParameter.Optional }

The page URL will be https://myproject/CAG/{item-id}

This is not a Sitecore page item

In the Index method of the Controller, I can access the Sitecore items. But here Sitecore.Context.IsLoggedIn always returns false.

public ActionResult Index(string id)
   bool isLoggedIn = Sitecore.Context.IsLoggedIn;
   var contextSite = Sitecore.Context.Site; //returns "website"

I have not created any patch configs.

Using Sitecore 10.1.2

  • By MVC area, are you referring to this? doc.sitecore.com/xp/en/developers/101/…. Have you tried this without an MVC area type of configuration? Is this happening on your local machine or upstream? Load balanced? Nov 21, 2022 at 13:15
  • No I have not tried with an MVC Area type. It's in my local.
    – sukesh
    Nov 21, 2022 at 13:37
  • During debug, which values are you seeing for these? Sitecore.Context.User, Sitecore.Context.User.IsAuthenticated, Sitecore.Context.User.IsNullOrAnonymous(). Does IsLoggedIn return the results you expect at the HttpRequestProcessor level? Nov 21, 2022 at 13:46
  • Did not check at HttpRequestProcessor level. Commented my original RouteConfig class and used yours instead. Context user is extranet\anonymous.
    – sukesh
    Nov 21, 2022 at 14:11

1 Answer 1


To avoid complications with testing, make sure to use different browsers or a private browser tab if you have an auth system on the front end that's separate from the backend.

Give this a try:

using System.Web.Mvc;
using System.Web.Routing;
using Sitecore.Pipelines;

namespace Client.Foundation.POC.Pipelines.Initialize
  public class InitializeRoutes : Sitecore.Mvc.Pipelines.Loader.InitializeRoutes
      public override void Process(PipelineArgs args)
              "VisitData", // Route name
              new { controller = "Visit", action = "Data" },
              new[] { "Client.Foundation.POC.Controllers" });
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
        <processor type="Client.Foundation.POC.Pipelines.Initialize.InitializeRoutes, Client.Foundation.POC" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
  • Should this be a new class? Should the existing AreaRegistration remain as is?
    – sukesh
    Nov 21, 2022 at 12:35
  • 1
    Yes. The idea would be to see if you continue to experience the issue with a slightly different configuration. Nov 21, 2022 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.