Mike Flynn
Mike Flynn

Reputation: 24325

Get ASP.NET MVC area in Global.asax

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);
        }

Upvotes: 0

Views: 144

Answers (1)

Tim
Tim

Reputation: 2707

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

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

Upvotes: 1

Related Questions