【发布时间】:2021-08-02 08:03:27
【问题描述】:
有没有办法在global.asax中获取ASP.NET MVC区域,具体方法如下?
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);
}
【问题讨论】:
-
看来您将在您的应用程序中使用奇怪的逻辑。让我们知道在 Asp.net Web 应用程序中提出更好、更合乎逻辑的解决方案以及正确的设计模式的主要目的。
-
清除一个区域的缓存并不奇怪lol
-
请描述更多。什么类型的清算?您的代码不像清除缓存那样显示。
-
对不起,作为一个 10 年的 Asp.net 开发人员,我无法理解您的意思!描述更多,否则我没有更多的帮助
标签: .net asp.net-mvc global-asax asp.net-mvc-areas