Get ASP.NET MVC area in Global.asax

131 Views Asked by At

Is there a way to get the ASP.NET MVC area in the global.asax, specficially the method below?

public override string GetVaryByCustomString(HttpContext context, string arg)
        {
            if (arg.ToLower() == "username" && context.User.Identity.IsAuthenticated) return context.User.Identity.Name;
       
            return base.GetVaryByCustomString(context, arg);
        }
1

There are 1 best solutions below

1
Tim On BEST ANSWER

Have you tried the solution found in this question/answer?

HttpContext.Current.Request.RequestContext.RouteData.DataTokens["area"]